Hacker News new | past | comments | ask | show | jobs | submit login

> need each user to make their own, probably buggy and slow allocator

What's wrong with malloc?




At 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.


Nothing I was thinking about allocations of more complex structures (that at the end use malloc)


We 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.


glibc 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...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: