Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Eric Poitras

Frame-Based Memory Allocation

This topic is 5304 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

If anyone read, understood and used the frame-based memory allocation routine from the game programming gems 1 book, please tell me how to actually use it. I understand the concept and everything behind the code but I just don''t know exactly how to load anything in like an image with SDL for example. PLEASE HELP ME!

Share this post


Link to post
Share on other sites
Advertisement
ummmm.... I thought i was preety clear in my first post... Anyway I''m talking about an article on Frame-Based memory allocation by Steven Ranck on the game programming Gems book. The only thing I don''t understand is how to load the data into the specific location in memory.

Say for example a bitmap loaded on an SDL Surface... How would I use the frame-based memory allocation example used in the book to loading a graphic in SDL.

So I AM talking about Frame-Based Memory Allocation. At least that''s the name of the article.

Share this post


Link to post
Share on other sites
That algorithm isn''t about loading resources or data into your app/engine it''s speciffically just a memory allocation routine to help you rid of :
1) memory fragmentation
2) speed up allocation (new/malloc are expensive routines)

So basically you use it like you would use new or malloc inside C/C++ code, it returns you a pointer to a location in memory in a bit more optimal manner. That''s all to it!

It''s a BLACK BOX system so you don''t add any loading or whatsoever to it just use it like an allocation routine, and build your loading on top of it, meaning separately.

Share this post


Link to post
Share on other sites
OH! so basically the function LoadFromDisk() that he created I can stick my loading routines in there and that will handle everything for me. If this is a better refined version of new and delete does that mean that every resource I load on top of this system has to be loaded as an object? like do I have to make a class for every resources if I want to load everything seperate or can I just not load everything directly.

An example would really help because I''m going to have to see something working to get my head around this.

Say for example I want to load boo.bmp to an SDL Surface or a DirectDraw Surface or whatever you would feel comfortable using as an example. ANY HELP IS GREATLY APPRECIATED!

Share this post


Link to post
Share on other sites

  • 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!