Jump to content
  • Advertisement
Sign in to follow this  
bluntman

Memory Allocator from a specified block of memory.

This topic is 2268 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anybody know of a good allocator that can use a specified block of memory as its pool? All the ones I can find seem to simply work on global pools or internally managed pools. I just want to give the allocator a big contiguous block of memory along with the size and have it return memory allocated from within that. Alternatively (although it is functionally the same) give it a pool size only have have it return blocks from the pool as offsets into it. I guess you could call it an abstract or virtual allocator...

Even better would be an entire system that will manage pointers into a block, where the block can be specified by me, which would include an allocator, and a pointer wrapper that deferences the allocated object from the specified block.
This (incase you haven't guessed) is to allow me to share memory between processes, and dynamically create and allocate objects into it.

Share this post


Link to post
Share on other sites
Advertisement
Take a look at TLSF (http://tlsf.baisoku.org/). We use this internally as our primary general-purpose allocator (and I know several other game companies do as well). That version is actually written by a co-worker, and is essentially the same code that we use internally on all of our projects. In addition to TLSF having great algorithmic behavior, that implementation/interface is also pretty simple and clean - in particular you just supply it a pointer and size to create a heap from a block of memory.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!