Really unload object code when it is safe to do so (#8039)
authorSimon Marlow <marlowsd@gmail.com>
Fri, 5 Jul 2013 14:57:32 +0000 (15:57 +0100)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 22 Aug 2013 09:54:09 +0000 (10:54 +0100)
commitbdfefb3b72a71cd0afca6e7766456c0d97c47c86
tree383142642ac70f002f403147d97c51d7e0f609ed
parent372053c968ef92dbb822afe38f4ce70c3a7553af
Really unload object code when it is safe to do so (#8039)

The next major GC after an unloadObj() will do a traversal of the heap
to determine whether the object code can be removed from memory or
not.  We'll keep doing these until it is safe to remove the object
code.

In my experiments with GHCi, the objects get unloaded immediately,
which is a good sign: we're not accidentally holding on to any
references anywhere in the GHC data structures.

Changes relative to the patch earlier posted on the ticket:
 - fix two memory leaks discovered with Valgrind, after
   testing with tests/rts/linker_unload.c
rts/CheckUnload.c [new file with mode: 0644]
rts/CheckUnload.h [new file with mode: 0644]
rts/Linker.c
rts/LinkerInternals.h
rts/sm/GC.c