3 ms·
Not only is it slow, many malloc() implementations (like even in glibc, I think) take a global lock, so they are prone to contention when called concurrently.
by haberman 13y ago
Not only is it slow, many malloc() implementations (like even in glibc, I think) take a global lock, so they are prone to contention when called concurrently. Other mallocs (like tcmalloc and Hoard) satisfy small allocations from a thread-local pool.
- scott_s 13y agoglibc's malloc has actually been decent with regards to concurrent memory allocation for a while now, in my experience. I googled around, and found someone talking about glibc's malloc not using a global lock: http://siddhesh.in/journal/2012/10/24/malloc-per-thread-arenas-in-glibc/ http://siddhesh.in/journal/2012/10/24/malloc-per-thread-aren...
- haberman 13y agoThanks for the info; good to know that glibc has improved in this regard. I'd correct my comment but it's no longer editable. :/