3 ms·
> malloc takes out a global lock Says who? The C Standard says nothing of the kind.
by zabzonk 7y ago
> malloc takes out a global lock
Says who? The C Standard says nothing of the kind.
- BubRoss 7y agoAll modern common implementations (I think). MSVC's malloc definitely locks. I think gcc, clang and icc do too. This is a big reason why tcmalloc and jemalloc were created.
- gpderetta 7y agoI don't know about MSVC, but glibc malloc has per thread caches. At some point you need to hit the global allocator or sbrk or mmap of course and that might take a global lock.