This is compiler specific and cannot be generalised as C++.
by jebarker
4 subcomments
Reading this was a good reminder not to be intimidated by assumptions about complexity. (Without giving it much thought) I would have assumed that it would be hard to replace malloc for such fundamental applications as ls, but it's surprisingly simple.
by Joker_vD
1 subcomments
Huh. Why is this emergency pool not statically allocated? Is it possible to tune the size of this pool on libc++ startup somehow? Because otherwise it absolutely should've been statically allocated.
by throwaway2037
2 subcomments
I would like the see the source code for libmymalloc.so, however, I don't see anything in the blog post. Nor do I see anything in his GitHub profile: https://github.com/jsikstro
Also, I cannot find his email address anywhere (to ask him to share it on GitHub).
Am I missing something?
by
0 subcomment
by Panzerschrek
0 subcomment
What happens if I turn exceptions off using -fno-exceptions compiler flag? Does C++ runtime still allocates this block of memory?
by anonymousiam
1 subcomments
So basically, before any of the code even runs, this environment begins by gobbling up more than the total RAM that most of my first computers had (SYM-1, IAMSAI-8080, Ferguson Big Board, Kaypro II, and CCS S-100 Z-80). All of these systems were 8-bit, with various RAM sizes from 8KB to 64KB. That was the maximum RAM available, and it was shared by the OS and the applications.
by znpy
0 subcomment
> TLDR; The C++ standard library sets up exception handling infrastructure early on, allocating memory for an “emergency pool” to be able to allocate memory for exceptions in case malloc ever runs out of memory.