A method and system for allocating and de-allocating memory for threads of
an application is provided. An allocation system provides a heap for
tracking free tokens of memory that are available for allocation to
threads of an application. A heap tracks collections of free tokens of
the fixed token size. The allocation system receives memory requests from
threads that specify an allocation type of allocate or de-allocate. When
multiple memory requests are pending concurrently from multiple threads,
then the allocation system attempts to combine memory requests of the
same type and of the same token size that are received from different
threads. One of the threads is responsible for updating the heap to
effect the two memory requests. The allocation system combines multiple
memory requests so that the heap need only be accessed once to allocate
or de-allocate multiple tokens.