<- Back
Comments (19)
- pjmlpThis is compiler specific and cannot be generalised as C++.
- jebarkerReading 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.
- Joker_vDHuh. 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.
- throwaway2037I 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/jsikstroAlso, I cannot find his email address anywhere (to ask him to share it on GitHub).Am I missing something?
- aliveintucsonI think you should read up on what "always" means.
- znpy> 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.Reminds me of Perl's $^M: https://perldoc.perl.org/variables/$%5EMIn Perl you can "hand-manage" that. This line would allocate a 64K buffer for use in an emergency: $^M = 'a' x (1 << 16);
- anonundefined