Memory Manager
Hi,
I''m woking on a shareware game colled Quest. And I need to find a coupel of things and I''m wondering if anybody can help me find them.
I need to find this;
Memory Manager:
I need a nice efficient memory manager. My code does a lot small allocations which ten to fragment the heap. The engine is dynamic and you create a object and destroy it as needed so there is a potential for heap fragmentation. Needs to be for C++, src and royalty free.
And this;
A scripting language:
Needs to be C, Pascal or C and/or Pascal like. Needs to be a byte-code interpreter (compiles to src to byte code then run, instead of translating the src each time. Needs to be have src and be royalty free. Needs to work with C++ compiler.
Does anybody know where I can find any of them. Any help would be greatly appreciated.
Thanks in advance
Leon Ljunggren
Ps. If you want to know more abaut Quest, or even be a beta tester, go to www.jdsgames.com (there isn''t much info there yet but a major update is coming). Ds.
Diplomacy means saying something soothing as you squeeze the trigger, right?
March 21, 2000 04:53 PM
Ok, here goes. I don''t know anything freely available, but this is how I would probably handle it.
Create a class called MemoryManager. In it, overload the new and delete operators. Create an array of void pointers to act as free lists. Then allocate a large chunk of memory up front, and use it as a memory pool. Use the overloaded new operator to take memory from the pool (amounts to just pointer arithmetic). Use the overloaded delete operator to move memory onto the freelists. This can be really easy to do if you''re clever with pointers. Then simply derive any class that you want to use this memory manager from the MemoryManager class. It will inherit the new and delete operators and use them.
There are a few holes for you to fill, but if you''d like I could probably write this code for you. I hope I didnt leave anything out.
This method should be particularly effective if you know (or can estimate) the size of the largest data structure you will allocate with this method.
Post here if you want more info.
Matt
Create a class called MemoryManager. In it, overload the new and delete operators. Create an array of void pointers to act as free lists. Then allocate a large chunk of memory up front, and use it as a memory pool. Use the overloaded new operator to take memory from the pool (amounts to just pointer arithmetic). Use the overloaded delete operator to move memory onto the freelists. This can be really easy to do if you''re clever with pointers. Then simply derive any class that you want to use this memory manager from the MemoryManager class. It will inherit the new and delete operators and use them.
There are a few holes for you to fill, but if you''d like I could probably write this code for you. I hope I didnt leave anything out.
This method should be particularly effective if you know (or can estimate) the size of the largest data structure you will allocate with this method.
Post here if you want more info.
Matt
Thanks
Diplomacy means saying something soothing as you squeeze the trigger, right?
Diplomacy means saying something soothing as you squeeze the trigger, right?
For that scripting language, I''m inclined to suggest Python. I''ve been looking at it lately for basically the same purpose. It comes with the functionality necessary to implement it as a scripting language, it''s object-oriented, and for the most part it''s syntax isn''t a far throw from the more mainstream programming languages.
Jonathan
Jonathan
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement