Open srepmub opened 1 year ago
since BDWGC uses malloc in the end?
BDWGC uses mmap to get memory from OS (on Linux). It uses calloc (to get the memory from OS) on some rare targets only (where no other better way to).
is safe to LD_PRELOAD a malloc substitute
If I understand you correctly you mean building the collector with --enable-redirect-malloc and passing libgc.so to LD_PRELOAD. I can't say about reliability, It works on some targets (e.g. Linux). You'd better to try on your platform. If your target should support multi-threaded apps, please check that pthread_create (and friends) are redirected to GC_pthread_create (it should be redirected but worth to check anyway because lack of the redirection cases random errors at runtime because the collector should know all threads manipulating with pointers to the heap).
hi,
I'm a long time user of the BDWGC, and use it as part of a restricted-Python-to-C++ compiler:
https://github.com/shedskin/shedskin
I was wondering if it is safe to LD_PRELOAD a malloc substitute (since BDWGC uses malloc in the end?). in a simple benchmark where lots of small objects are allocated, it does seem to help a lot to use for example libjemalloc.