Support for memory allocator with GC #35

Open
akrymski opened this Issue Nov 27, 2013 · 2 comments

Comments

Projects
None yet
2 participants

The LLJS memory allocator does not support automatic garbage collection currently. Would be nice to be able to switch GC on/off when compiling. If the GC is turned on, the memory allocator would fall back to not using an ArrayBuffer at all - thus running like regular js. Alternatively could even try adding a Boehm GC to LLJS :)

Owner

mbebenita commented Nov 28, 2013

Part of the reason to use something like LLJS is to avoid automatic memory management, but someone could certainly implement a Boehm GC however it can get quite complicated since pointers can leak into plain JS objects. The other researchy problem is what to do with dead JS objects that hang on to malloc allocated things. In JS, there is no way to get notified of or detect that an object is about to be garbage collected, so there is no opportunity to free the malloc'ed memory.

How about something like Automatic Reference Counting instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment