Prevent Memory Fragmentation

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Prevent Memory Fragmentation

Post 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.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Hi,

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

Cheers,
Adam
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

Nice. Thank you. I'll read it.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
Post Reply