memory manager
memory manager
I have finally gotten to the point of being able to add a memory manager. But the problem is that I don't know where to start. What excalty do I need to be able to get a fully functional mm? I belive I need to make a malloc()/free() function. But I could be wrong. There might also be other parts that I'm unaware of. Any help about where to start or what to do would be grealy apprcitated. Thanks in advanced.
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Re: memory manager
I initially started making my own memory manager... kept two stacks of pages and would maintain a large heap by adding or subtracting pages to the top of the heap.
This worked... but the more I tried to optimize it's speed and minimize its fragmentation, the more I realized I was duplicating effort. Not long after I switch to using Doug Lee's malloc() code (search for dlmalloc).
Not only is dlmalloc (and dlfree) an efficient and useful memory management code-set, but it's also in the public domain.
In order to use dlmalloc all you really need to define are a couple standard unix headers, some #defines, a couple unix error codes, and either sbrk() or morecore().
Then, set the appropriate defines in the header file and you're off. Instant plug-in memory management (allowing one to focus on much cooler aspects of their OS).
--Jeff
This worked... but the more I tried to optimize it's speed and minimize its fragmentation, the more I realized I was duplicating effort. Not long after I switch to using Doug Lee's malloc() code (search for dlmalloc).
Not only is dlmalloc (and dlfree) an efficient and useful memory management code-set, but it's also in the public domain.
In order to use dlmalloc all you really need to define are a couple standard unix headers, some #defines, a couple unix error codes, and either sbrk() or morecore().
Then, set the appropriate defines in the header file and you're off. Instant plug-in memory management (allowing one to focus on much cooler aspects of their OS).
--Jeff
Re: memory manager
Thanks, I'll try that later on today.