Memory management in 40 major C projects, a survey
The Consensus, which indexes code from over 400 major infrastructure projects, surveyed 40 major C projects and counted how each allocates memory. The count is based on allocation call sites, excluding test code, third-party code and examples, and the article notes that this is a limited metric that does not account for sub-regions or allocation size.
Eight projects allocate only with malloc and free, and two never use them. Fifteen projects use regions[1] at some point, seven primarily use regions, five primarily use garbage collection[2], and three primarily use reference counting[3]. seL4 is an exception because it has no heap at all.
SQLite allocates 100% manually, while cURL and Redis allocate mostly manually (94% and 79%) and use reference counting for only some of their objects. Linux and QEMU have recently started using scope-based cleanup[4] through compiler extensions, such as Linux's __free(kfree) and QEMU's g_autofree.
Read the original theconsensus.devDiscussion
Discussion
Commenters mostly say the analysis is thin on methodology and ask whether it was simply grep plus manual classification. They note that regions seem common in server-like software, while garbage collection and reference counting are common in programming languages. One commenter says subsystems that manage their own memory could skew the counts, and another doubts that Linux has no reference counting at all.
Sources
-
The Consensus
Memory management in 40 major C projects, a survey
-
KRGeekNews KO
주요 C 프로젝트 40개의 메모리 관리 방식 조사


