HomeWildfire Games

Atlas: Updated wxJS to latest SVN version. Made the JS runtime have a greater…


Atlas: Updated wxJS to latest SVN version. Made the JS runtime have a greater lifetime than all the wx windows, to avoid garbage collection problems.
IGUIObject: Cache the JSObject*, to prevent some frequent allocation while running GUI scripts.
JSInterface_IGUIObject: Fixed garbage collection issues.
JSInterface_IGUIObject, ScriptGlue: Changed to the JS_THREADSAFE form of JS_GetClass.
Util: Avoid startup warnings on Linux caused by using unimplemented cpu_* functions that aren't needed for anything important yet.
sysdep/unix: Changed to native line endings.


philipJun 9 2007, 12:56 AM
rP5153: Removing old wxJavaScript

Event Timeline

elexis added a subscriber: elexis.Dec 14 2018, 11:17 AM
elexis added inline comments.

Is this still (or has it ever been) actually the case?
There is "automatic unrooting on destruction" https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS::PersistentRooted and since PersistendRooted variables are rooted in the JSContext, they should be deleted when the page is closed, i.e. as intended, no? Perhaps this was not the case in 2007 but now is?
(Does this relate to the MEGA TODO from rP141 in Destroy of IGUIObject.h?)



lyv added a subscriber: lyv.Dec 14 2018, 11:59 AM
lyv added inline comments.

Seems like they are associated with the runtime as opposed to the JSContext.

These roots can be used in heap-allocated data structures, so they are not associated with any particular JSContext or stack. They are registered with the JSRuntime itself, without locking, so they require a full JSContext to be initialized, not one of its more restricted superclasses.

Maybe I am misunderstanding something here?

elexis added inline comments.Dec 18 2018, 3:34 PM

Ah yes, I was already equating JSRuntime with JSContext https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases/45#Future_Direction

The patch to change it to JS::Heap is simple, but measuring the memory leak isn't.
valgrind + massif is something that was slow and I suspected it won't show conclusive evidence easily.
I have shown allocated memory using ps and called this function GetGuiObjectByName on hundreds of thousands of GUIObjects, but the allocated memory didn't seem to increase.