3 ms·
Because there's no such thing as a truly general purpose memory allocator. Memory allocation is built to some purpose, and the programmer who uses it should be
by dragontamer 6y ago
Because there's no such thing as a truly general purpose memory allocator.
Memory allocation is built to some purpose, and the programmer who uses it should be aware of its problems. There's probably a technical reason why the original glibc malloc does what it does (probably better optimized for low-thread counts)
- api 6y agoWhat you say is technically true but can be used to just hand wave away any issue. Things can almost always be improved. Allocators like TCMalloc are not significantly worse in single threaded mode. The glibc allocator just isn’t very good. I have personally fought with the glibc allocator and seen issues with it that don’t exist on other OSes.
- trasz 6y agoIn FreeBSD, the malloc libc uses is jemalloc. Works fine for a general-purpose allocator.
- klodolph 6y agoHistorically the glibc allocator had a number of hooks as well as support for unexec(). I think unexec() has been killed (thankfully) but the glibc allocator API is still not exactly equal to other allocator APIs.
- kevingadd 6y agoI'm not aware of any production use cases where tcmalloc would be worse than glibc malloc in a way that end users would actually feel. tcmalloc and jemalloc are used all over the place in all sorts of different applications. If glibc malloc is so bad at something like this I find it hard to believe it would be great at anything important if jemalloc/tcmalloc are not.