memory management

  • From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 12 Apr 2009 09:29:55 -0600

Hello list,
I'm working on building a kernel from scratch (just for something to do, I'm 
learning quite a lot out of it), and have a question.
I was thinking about how I'm going to implament the MM (memory manager).
I had an idea of making blocks of memory available, putting a used or unused 
flag on them for now. each block would be of set size, and I could have a 
lookup table of sorts.
My other idea was to make them all hold pointers to the next block of data.
Now, I'm seeing issues with both problems.
If I keep a list of reserved memory, and add a structure to the end of the list 
when a new chunk of memory is requested, that works great. But then we have the 
issue of memory getting destroyed in the middle.
If someone requests a 1KB block and someone else requests 512 and then frees 
it, I can delete that and mark that memory as unused; my issue is this.
Eventually my memory is going to be split up enough that it will require I 
"compact" it to fill in those gaps, which would break any code referencing that 
memory.
Is there an easier way to do this?


Thanks,
Tyler Littlefield
Web: tysdomain.com
email: tyler@xxxxxxxxxxxxx
My programs don't have bugs, they're called randomly added features.

Other related posts:

  • » memory management - Tyler Littlefield