physX_load() in Debug-run

Posted By: bodden

physX_load() in Debug-run - 02/08/11 08:53

Just a small one:

I use physX_load() and physX_run() instead of physX_open().

When doing so, I think, in debug-run, the physik-engine is not been closed automatically. The first time, you run the script in debug-mode, everything is OK. But if you exit and run it again (in debug-mode), you got a "Script crash in SYS"-error. You have to close and reopen the whole editor to be able to run it again.

It's easy to solve by using "physX_close()" before leaving the script, but this is not mentioned in manual.

You can test it with a simple example:
Code:
function main()
{
	void* physikengine=physX_load();
	
	//physX_close();
	
}



As the problem only occurs in debug-mode, but not in "normal"-mode, I guess it's a bug.
Posted By: WretchedSid

Re: physX_load() in Debug-run - 02/08/11 12:26

Its not a bug as in debug mode the engine is attached to the SED process. In normal mode the OS will clean the memory you have leaked and wipe your state on exit, but not in debug mode.

So I guess thats what they call intended behavior =/
Posted By: bodden

Re: physX_load() in Debug-run - 02/08/11 13:26

So, it's a feature, not a bug. OK, my fault laugh
Posted By: Quad

Re: physX_load() in Debug-run - 02/08/11 13:34

Not exactly a feature but yeah, your fault.
Posted By: jcl

Re: physX_load() in Debug-run - 02/08/11 13:43

The physics engine is not closed automatically. It must be closed by calling physX_destroy().

http://manual.3dgamestudio.net/physX_destroy.htm

Normally this happens automatically in the on_exit event in ackphysx.h, but if you don't use it, you must take care that your script closes the physics engine on exit. When you debug your script and terminate it with the red abort button, there is no clean-up and all open interfaces, including the physics engine, stay open. You need then to close SED for releasing all interfaces.
© 2024 lite-C Forums