#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
#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
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...
malloc 은 커널에서 큰 메모리 영역을 확보한 뒤 사용자 공간에서 나눠 할당 해 시스템 호출 비용을 줄임. glibc 에서 malloc(16) 을 1,000번 호출한 실험은 첫 호출에서만 brk 를 두 번 실행함 각 할당에는 크기를 기록하는 청크 헤더 가 있으며, 해제한 공간은 재사용함. 빈 청크를 분할하거나 인...
malloc 은 커널에서 큰 메모리 영역을 확보한 뒤 사용자 공간에서 나눠 할당 해 시스템 호출 비용을 줄임. glibc 에서 malloc(16) 을 1,000번 호출한 실험은 첫 호출에서만 brk 를 두 번 실행함 각 할당에는 크기를 기록하는 청크 헤더 가 있으며, 해제한 공간은 재사용함. 빈 청크를 분할하거나 인...
https://benmandrew.com/articles/what-is-malloc-doing-anyway
https://news.ycombinator.com/item?id=50424157
https://benmandrew.com/articles/what-is-malloc-doing-anyway
https://news.ycombinator.com/item?id=50424157
https://napcakes.nekoweb.org/posts/malloc/
https://news.ycombinator.com/item?id=50362466