I have a program that uses a custom memory allocator via an arena that needs to be initialized on program start. This is built to run hundreds of thousands of test cases with 0 memory leaks. I would ideally like to compile this as a DLL, but the problem is that operator new is still visible, even when the visibility is explicitly set to hidden. From what I understand, this is a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81107
So, my two options are:
- Disable operator new for DLLs, resulting in memory leaks
- Preserve operator new for DLLs, resulting in, well...
$ python
Python 3.12.7 (main, Oct 1 2024, 11:15:50) [GCC 14.2.1 20240910] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pynoko
[Heap.cc:139] WARN: HEAP ALLOC FAIL: Cannot allocate 8 from heap (nil)
zsh: segmentation fault (core dumped) python
My ideal third option is that operator new is scoped to the DLL and isn't exposed to anything else. I would like to avoid switching to clang if at all possible - anyone have any ideas?
