It segaults. I suspect I could simply reproduce it by doing a large enough number or size of malloc, dybnamically sized array, operations from within the constructor code. Will try that.
Basically, either trigger brk a second time from within the library constructor/CTOR code or triggering brk too many times, messes with the system and creates crashes later when the main program runs.
I will look. All initialization done in the constructor, completes and wrapped with lazy_static and hence with Once code. I will check again. But they don complete fine, which suggests there is no recursion.
I suspect it may have something to do with the amount malloc happenning inside the constructor forcing heap resizing.
Are you aware of any heap size limits for library constructor code?
Is there way to pepare during compilation for a larger limit for this.
This is what I am driving towards. But still figuring out the right way to initialize within a Once, and where to invoke that innitialization. As the initialization code itself uses some of the intercepted code and causes recursion. I will continue to hack down this path as well.
The recursion I meant would be something indirect, where the first initialization might somehow lead to other code that tries to access that static too, re-initializing it before the first time has completed. It wouldn't have to be infinite recursion to be a problem. But I'm just guessing.
I don't know of any heap limits during constructors, but if you suspect the allocator is broken, you could try an alternate like jemalloc.