Really unload object code when it is safe to do so (#8039)

Authored by Simon Marlow <marlowsd@gmail.com>.

Description

Really unload object code when it is safe to do so (Trac #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

Details

Committed
Simon Marlow <marlowsd@gmail.com>Aug 22 2013, 4:54 AM
Parents
rGHC372053c968ef: In the non-threaded RTS, make *_barrier functions EXTERN_INLINE, not #define.
Branches
Unknown
Tags
Unknown