Optimizing C multithreaded memory management using thread-local storage

Yair Sade*, Mooly Sagiv, Ran Shaham

*Corresponding author for this work

Research output: Contribution to journalConference articlepeer-review


Dynamic memory management in C programs can be rather costly. Multithreading introduces additional synchronization overhead of C memory management functions (malloc, free). In order to reduce this overhead, we extended Hoard - a state of the art memory allocator with the ability to allocate thread-local storage. Experimental results using the tool show runtime saving of up to 44% for a set of memory management benchmarks. To allow transparent usage of thread-local storage, we develop a compile-time algorithm, which conservatively detects allocation sites that can be replaced by thread-local allocations. Our static analysis is sound, i.e., every detected thread-local storage is indeed so, although we may fail to identify opportunities for allocating thread-local storage. Technically, we reduce the problem of estimating thread-local storage to the problem of escape analysis and provide an efficient escape analysis for C. We solve the problem of escape analysis for C using existing points-to analysis algorithms. Our solution is parameterized by the points-to information. We empirically evaluated the solution with two different methods for computing points-to information. The usage of scalable points-to analysis algorithms and the fact that our reduction is efficient, guarantees that our static analysis technique is scalable.

Original languageEnglish
Pages (from-to)137-155
Number of pages19
JournalLecture Notes in Computer Science
StatePublished - 2005
Event14th International Conference on Compiler Construction, CC 2005, held as part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2005 - Edinburgh, United Kingdom
Duration: 4 Apr 20058 Apr 2005


Dive into the research topics of 'Optimizing C multithreaded memory management using thread-local storage'. Together they form a unique fingerprint.

Cite this