snmalloc icon indicating copy to clipboard operation
snmalloc copied to clipboard

Maybe missing _base variants in overrides

Open Naville opened this issue 1 year ago • 2 comments

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:

  • Why these _base variant calls appeared in the final binary when no source code referenced them?
  • Should snmalloc provide overrides for them too?

Naville avatar Sep 21 '23 04:09 Naville

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

CC @mjp41

Naville avatar Sep 21 '23 07:09 Naville

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.

mjp41 avatar Sep 21 '23 08:09 mjp41