Daniel
Daniel

Reputation: 4314

C: memory pool library?

I need some fast, thread safe memory pooling library. I've googled a lot, but fast solutions don't have thread safety, while others are really big.

Any suggestions?

Upvotes: 8

Views: 6657

Answers (4)

Necrolis
Necrolis

Reputation: 26171

Both nedmalloc and ptmalloc are C based thread caching memory managers, based around doug lea's malloc(the core of most linux allocators). They are both under good licences as well, unlike hoard, which requires payment for commercial use, last I looked. Googles tcmalloc also has C bindings iirc, and is built from the ground up as a thread caching allocator, as well as some built in heap and cpu profiling tools, it is however build for massive memory usage(the example they give is 300mb+ per thread), and as such many not work as well as expected for smaller scale apps

Upvotes: 8

J-16 SDiZ
J-16 SDiZ

Reputation: 26910

Have you tried Hoard?

See also these two articles from Intel.com

Upvotes: 0

Joshua
Joshua

Reputation: 43227

You're supposed to use one memory pool per thread.

Upvotes: 1

Raph Levien
Raph Levien

Reputation: 5218

The Apache Portable Runtime works well and shouldn't be all that big.

Upvotes: 0

Related Questions