[Gc] Memory leak in GC_allochblk_nth
ivmai at mail.ru
Tue Nov 25 11:56:37 PST 2008
My problem is as follows...
My (demo/test) application allocates several large (>300K) atomic objects, drops them quickly and repeats this alocation/dropping cycle many times - as a result I observer memory leakage (together with the repeated GC warning about it) and, then, some time later, out of virtual memory. Naive removal of the code block around WARN("Repeated allocation of very large block...") (together with "size_avail = orig_avail;") doesn't help at all (even more it results in "unreasonable heap growth").
So, there are several possible (and working) solutions: turn off all_interior_pointers mode and/or use "ignore_off_page" versions of GC_malloc[_atomic]() (or choose between normal and "ignore_off_page" versions dynamically). But these solutions require addition of "volatile" qualifier for pointers (to prevent compiler optimization) which is not acceptable to me.
1. Is it possible to fix GC_allochblk_nth() to prevent memory leak for GC_malloc with all_interior_pointers mode on (even if it results in "unreasonable heap growth")?
2. What's the difference between "normal" and "ignore_off_page" versions of GC_malloc if all_interior_pointers mode if off? (and what's the difference between all_interior_pointers mode on and off for GC_malloc_ignore_off_page?)
More information about the Gc