Page 1 of 1

Prevent Memory Fragmentation

Posted: Fri Jun 01, 2007 5:06 am
by XCHG
I deleted all the code I had previously written for my physical memory manager and started from scratch. I coded the initialization and allocation for today and tomorrow will finish the deallocation and etc.

Now what my memory manager does is that it finds a block of of pages as big as the requested number of pages in the available memory space and then allocates that for the user (if the user has requested the pages to be committed and not reserved). However, I am wondering about fragmentation that will happen after allocating and deallocating a lot of memory. What are the ways of preventing scattered memory and fragmentation while managing the memory? I'd appreciate it if someone could give me some insights.

Posted: Fri Jun 01, 2007 5:10 am
by AJ
Hi,

For physical frame allocation, see http://www.osdev.org/wiki/Page_Frame_Allocation for a few ideas.

Cheers,
Adam

Posted: Fri Jun 01, 2007 8:11 am
by XCHG
Nice. Thank you. I'll read it.