Original Post
🔒 Locked
Memory management
Advertisement
That is a very vague question. What is your memory management system going to be used for? A solution could range from simple reference counting to a full garbage collector. It all depends on what it''s for. From what I''ve read of the quake (quake 2 at least), I dont suggest using it as much of a reference for anything modern. Both quake and doom were designed to run on a 486 with very limited memory. Today, you can get away with pre-allocating large blocks of memory at load time and not worrying about whether or not your 101''th mesh will fit into ram.
Unless you''re having performance problems, just use new and delete for allocation (assuming C++ here), and possibly simple reference counting.
Unless you''re having performance problems, just use new and delete for allocation (assuming C++ here), and possibly simple reference counting.
Yeah you''re probably right. I was just planning on reference counting and allocating a big (logically) contiguous block of memory for my game objects and other such crap. I really just wanted the application to sit nicely in it''s own fixed block of memory. I just read an article at www.memorymanagemnt.org and for all intents and purposes, I''d be better of just going with new/delete.
I think you would be better off not using any type of memory allocation. Make all your stuff global. Even though your exe might seem quite large it really shouldn''t matter. With the RAM that the machines have these day''s it doesn''t really matter if your exe is 256K or 100MB. Plus shuffling around through a hunk of RAM is a PITA ( pain in the @$%$). Save yourself the headache of keeping track of starting addresses and lengths and avoid manually allocating memory.
It''s nice to use STL structures like vectors and lists because not only do they manage the memory for you, they also try hard to do so in an intelligent way that reduces fragmentation and increases speed. For example, adding 100 elements to a vector won''t resize it 100 times, even though it''s managing the memory for you.
[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement