3 ms·
> need each user to make their own, probably buggy and slow allocator What's wrong with malloc?
by saagarjha 8y ago
> need each user to make their own, probably buggy and slow allocator
What's wrong with malloc?
- dvh 8y agoNothing I was thinking about allocations of more complex structures (that at the end use malloc)
- flohofwoe 8y agoAt least in game development, custom allocation code is often used to either provide more debugging and profiling capabilities, or otherwise add functionality to the generic C or C++ allocator. Every good middleware library provides a way to hook into memory allocation, and ideally annotates each allocation with some sort of tag or label, so it's possible to track from the outside what an allocation was used for.
- maccard 8y agoWe use wrappers where I work, as we track all allocations. We can provide application context if something goes wrong, we can track usage (per thread, per subsystem, over time), and probably most importantly, we know the allocation pattern of our applications better.
- q3k 8y agoglibc malloc provides a way of hooking into memory management calls without having to use wrappers: https://www.gnu.org/software/libc/manual/html_node/Hooks-for-Malloc.html https://www.gnu.org/software/libc/manual/html_node/Hooks-for...