[Gc] Avoid GC_calloc-like semantics

Adam Warner lists at consulting.net.nz
Sat Jul 16 18:58:51 PDT 2005


Hello Hans,

Thank you for your wonderful garbage collector that works in very hostile
environments.

GC_malloc is closer to calloc's semantics since it guarantees that
allocated memory is cleared exactly like calloc. I have situations where I
need to duplicate non-atomic allocations. Ordinarily this would consist of
a malloc and a memcpy. Substituting GC_malloc for malloc leads to the
allocation first being cleared before it is instantly filled via memcpy.

Will you expose a non-atomic non-zeroing allocator as part of your public
API? I suggest the name GC_malloc_nonatomic_nonzero, which is scary enough
to stop people from using it before they understand its implications.

Thank you,
Adam



More information about the Gc mailing list