Ah, My memory aint what it used to be ...
Posted: Mon Jan 08, 2007 12:40 am
Hey guys ...
Ive been pondering Userspace MM methods for about 4 days now. Personally, I like the idea of self contained Userspace allocation zones - the App developer just creates the object he wants, and allocates as he wishes from it - aware of the constraints he himself set.
However, my current system still has some kinks which I consider serious.
The kink being, when you splice a chunk into two chunks, thats all fine. Splice a spliced chunk - and thats all well and good - except for the fact that 4bytes isnt being registered by either chunk.
The thought train that im on right now is leading to some somewhat complicated answers to this - like ... if a block has been spliced, and is going to be spliced again - scan for a free chunk adjacent and expand that, instead of carving a new chunk and losing that 4bytes.
Another idea I had was ... like, Buddy allocation internal to the Object. The developer would create this object, and set the minimum block size, the maximum block size, the object size. And it would be standard buddy allocation within the confines of the Object entity.
Why am I investigating these ideas? Simply because one problem with standard malloc/free type implementations bother me :
I Want the heap to grow when needed, and to shrink when possible.
If a page was once allocated to satisfy some heap expansion, but those pages are no longer in use - free them back to the system for use elsewhere.
However, Ways to determine whether the heap has 'shrunk' below the 'heap tail pages' kinda confuses me. I figure expansion of the Heap is simple :
Keep a address in the Malloc system tellign you the HIGHEST address possible, if you are trying to allocate from the current 'free point', and it goes over that limit - allocation of pages to satisfy the allocation is done and the HIGHEST address is updated.
One way I was pondering to detect whether the trailing heap pages were being used or not was have another variable, that tracks the 'end' of the highest allocation, if that ever sunk below a trailing page, free that page.
Im curious to how a lot of you manage your userspace memory.
Do you just... keep the pages allocated for the heap as it grows until the process is destroyed? Do you expand and shrink it to suit the time and usage? Id also be interested in the basic concept of how you shrink / expand, if you do so.
Again, I personally like self contained entities of Memory space - which is completely customized by the Developer for whatever use he needs to meet.
Anywho, Im sleepy so I shall hop into bed and hopefully dream up a solution .
~Z
Ive been pondering Userspace MM methods for about 4 days now. Personally, I like the idea of self contained Userspace allocation zones - the App developer just creates the object he wants, and allocates as he wishes from it - aware of the constraints he himself set.
However, my current system still has some kinks which I consider serious.
The kink being, when you splice a chunk into two chunks, thats all fine. Splice a spliced chunk - and thats all well and good - except for the fact that 4bytes isnt being registered by either chunk.
The thought train that im on right now is leading to some somewhat complicated answers to this - like ... if a block has been spliced, and is going to be spliced again - scan for a free chunk adjacent and expand that, instead of carving a new chunk and losing that 4bytes.
Another idea I had was ... like, Buddy allocation internal to the Object. The developer would create this object, and set the minimum block size, the maximum block size, the object size. And it would be standard buddy allocation within the confines of the Object entity.
Why am I investigating these ideas? Simply because one problem with standard malloc/free type implementations bother me :
I Want the heap to grow when needed, and to shrink when possible.
If a page was once allocated to satisfy some heap expansion, but those pages are no longer in use - free them back to the system for use elsewhere.
However, Ways to determine whether the heap has 'shrunk' below the 'heap tail pages' kinda confuses me. I figure expansion of the Heap is simple :
Keep a address in the Malloc system tellign you the HIGHEST address possible, if you are trying to allocate from the current 'free point', and it goes over that limit - allocation of pages to satisfy the allocation is done and the HIGHEST address is updated.
One way I was pondering to detect whether the trailing heap pages were being used or not was have another variable, that tracks the 'end' of the highest allocation, if that ever sunk below a trailing page, free that page.
Im curious to how a lot of you manage your userspace memory.
Do you just... keep the pages allocated for the heap as it grows until the process is destroyed? Do you expand and shrink it to suit the time and usage? Id also be interested in the basic concept of how you shrink / expand, if you do so.
Again, I personally like self contained entities of Memory space - which is completely customized by the Developer for whatever use he needs to meet.
Anywho, Im sleepy so I shall hop into bed and hopefully dream up a solution .
~Z