From: Kensuke M. <mat...@ki...> - 2012-06-06 13:15:42
|
Hi, http://linux.die.net/man/1/libgc says "This makes it much easier for the collector to place large objects. These are recommended for large object allocation. (Objects expected to be larger than about 100KBytes should be allocated this way.)" According to GC_allochblk_nth (in allchblk.c) and BL_LIMIT (in gc_priv.h), blacklisting works efficiently if IGNORE_OFF_PAGE is on, because GC can skip black list checking after HBLKSIZE bytes. And big object allocation without IGNORE_OFF_PAGE risks a false reference. Thanks Kensuke (2012/06/06 19:20), Arno Puder wrote: > GC_MALLOC_ATOMIC() is used for arrays that do not store object > references (e.g., new byte[500000]). In this case it is clear that the > memory region cannot contain references to other objects and hence the > GC does not need to scan this region. Ultimately this is done as an > optimization. Whether GC_MALLOC_ATOMIC() should be used or not is > determined in XMLVMArray_getTypeInfo() > (native_org_xmlvm_runtime_XMLVMArray.c). Can you please elaborate how > this introduces a leak? > > Arno > > > On 6/6/12 12:12 PM, Kensuke Matsuzaki wrote: >> Hi, >> >> Now xmlvm2c uses GC_MALLOC_ATOMIC in XMLVMArray. >> This causes memory leak, when I allocate large array (like new byte[500000]). >> Perhaps xmlvm2c can use GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE instead of GC_MALLOC_ATOMIC, >> because array object has reference by head of allocated area. >> >> Thank you. >> |