2 ms·
This is quite possibly an uninformed question, but is it possible to use multiple allocator implementations simultaneously in the same program? Obviously this
by Reelin 7y ago
This is quite possibly an uninformed question, but is it possible to use multiple allocator implementations simultaneously in the same program?
Obviously this would introduce additional creative ways in which to mess up memory management, but at least theoretically it seems like it ought to be doable. When I tried to search for information on the topic just now, I found only a few items about using multiple allocators in C++ that involved the STL and templates, but nothing about low level code or best practices.
- pizlonator 7y agoYeah you can but then you pay a tax on free() because you have to do some dispatch to decide what algorithm you are using. The more algorithms the higher the tax. Also, you want to make sure that the mallocs can share free pages with each other directly. Otherwise you will likely het higher peak memory overhead or worse perf or both.
- glandium 7y agoThe systwm allocator on macOS supports multiple "zones", which can each be backed by different allocators.