#Malloc
What is malloc doing, anyway?

#HackerNews

<a href="https://benmandrew.com/articles/what-is-malloc-doing-anyway" class="hover:underline text-blue-600 dark:text-sky-400 no-card-link" target="_blank" rel="noopener" data-link="bsky">https://benmandrew.com/articles/what-is-malloc-doing-anyway
November 9, 2026 at 1:54 PM
Correction: the issue wasn't the malloc() mutex, it was the _ITERATOR_DEBUG_LEVEL=2 mutex which is also global and shared by all MSVC containers 😡
I just halved my renderer startup time in debug by simply not running glslang in parallel.
Turns out it relies on tons of small calls to `malloc()`, which on the default Debug CRT on Windows uses a global mutex.
Still uses all available cores in Release.
Heaps still don't lie...
November 8, 2026 at 2:29 PM
November 9, 2026 at 1:10 PM
just saw someone pronounce malloc like moloch
November 4, 2026 at 7:25 PM
November 9, 2026 at 10:53 PM
What is malloc doing, anyway?
Comments
benmandrew.com
November 9, 2026 at 2:40 PM
This article explores how memory allocators like malloc function by managing syscalls, heap growth, and chunk bookkeeping. It demonstrates that efficient allocators minimize expensive kernel interactions by reusing memory blocks and using smart caching.
What is malloc doing, anyway? (198)
malloc has a very nice and simple interface: you ask for a certain amount of memory, and you’re given a void pointer to your block of contiguous bytes that’s been magicked into existence. Once you’re done with it, you call free with the same pointer and the memory disappears into the ether.
news.ycombinator.com
November 9, 2026 at 10:45 PM
November 9, 2026 at 12:44 PM
What is malloc doing, anyway? (benmandrew.com)

Discussion | Main Link
November 9, 2026 at 4:11 PM
malloc은 대체 무슨 일을 할까?

malloc 은 커널에서 큰 메모리 영역을 확보한 뒤 사용자 공간에서 나눠 할당 해 시스템 호출 비용을 줄임. glibc 에서 malloc(16) 을 1,000번 호출한 실험은 첫 호출에서만 brk 를 두 번 실행함 각 할당에는 크기를 기록하는 청크 헤더 가 있으며, 해제한 공간은 재사용함. 빈 청크를 분할하거나 인...
malloc은 대체 무슨 일을 할까?
malloc 은 커널에서 큰 메모리 영역을 확보한 뒤 사용자 공간에서 나눠 할당 해 시스템 호출 비용을 줄임. glibc 에서 malloc(16) 을 1,000번 호출한 실험은 첫 호출에서만 brk 를 두 번 실행함 각 할당에는 크기를 기록하는 청크 헤더 가 있으며, 해제한 공간은 재사용함. 빈 청크를 분할하거나 인...
news.hada.io
November 9, 2026 at 7:00 PM
November 4, 2026 at 8:10 AM
What is malloc doing, anyway?
comments · posted on 2026.11.09 at 06:31:05 (c=0, p=4)
November 9, 2026 at 12:45 PM
the lost malloc() - gardenweb
napcakes.nekoweb.org
November 4, 2026 at 11:03 AM
The lost malloc()
The lost malloc()
napcakes.nekoweb.org
November 4, 2026 at 11:08 AM