Quote:
reversing the order of the memory blocks and rethinking the logic a little.
That's what I did before when I had a simple allocator, but I will use this in a specialized (slow) function to go through the lowest heaps.
If I'm working with the absolute biggest memory areas in the memory map, they should normally always be in the highest address don't you think so? They always are like this:
< 4GB: Some fragmented memory and system IO
> 4GB: maybe some MMIO, then a big contiguous chunk of 10 GB of RAM.
So I'm forcibly consumming memory from the highest address.
And even in malloc instead of going through a bunch of lists, there is a very very easy method that I discovered that will return the biggest chunk probably faster than your best case scenario lol
SMP boot area is preallocated by the bootloader though
Well what if some pc has 6 GB of RAM (probably will contain bigger chunks in the low 4G), well drivers run first so I don't think the low 4GB would be eaten. If you install a driver it can run on runtime or if it quits because of "no memory below 31 bits lets say" we can advise the user to reboot.