microsoft / snmalloc

Message passing based allocator
MIT License
1.57k stars 106 forks source link

Maybe missing _base variants in overrides #638

Open Naville opened 1 year ago

Naville commented 1 year ago

Continuing the discussion from #631 since that one is closed....

After applying the patch that also overrides _msize_base, the project compiles. but got greeted with many "Not allocated by this allocator" error.

Running dumpbin /SYMBOLS on the ucrt lib shows there is a _base variant for many other heap related APIs.

I wonder these information that might requires some microsoft internal employee's knowledge:

Naville commented 1 year ago

my fork seems to workaround existing issue, though it seems you also need to implement _recalloc and maybe _recalloc_base

CC @mjp41

mjp41 commented 1 year ago

The jemalloc compat basically has _recalloc. If you specialise to the flag being set to say it should be zeroed:

https://github.com/Naville/snmalloc/blob/583cd5da55de58fe320a7054ce15d980071ed44c/src/snmalloc/override/jemalloc_compat.cc#L267-L302

Happy to add this overrides.