mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-09 03:41:10 +08:00
SVN r3895 (partial)
Coalesce free memory blocks before resizing a block in case it grows; coalesce after resizing only if the block shrinks.
This commit is contained in:
parent
f8c9d50c11
commit
575ba6749d
@ -327,11 +327,12 @@ bool DOS_ResizeMemory(Bit16u segment,Bit16u * blocks) {
|
||||
|
||||
if (*blocks > total)
|
||||
DOS_CompressMemory(segment-1);
|
||||
else
|
||||
DOS_CompressMemory();
|
||||
|
||||
if (*blocks<=total) {
|
||||
if (GCC_UNLIKELY(*blocks==total)) {
|
||||
/* Nothing to do */
|
||||
DOS_CompressMemory();
|
||||
return true;
|
||||
}
|
||||
/* Shrinking MCB */
|
||||
@ -367,7 +368,6 @@ bool DOS_ResizeMemory(Bit16u segment,Bit16u * blocks) {
|
||||
mcb_next.SetPSPSeg(MCB_FREE);
|
||||
mcb.SetType(0x4d);
|
||||
mcb.SetPSPSeg(dos.psp());
|
||||
DOS_CompressMemory();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -380,7 +380,6 @@ bool DOS_ResizeMemory(Bit16u segment,Bit16u * blocks) {
|
||||
}
|
||||
mcb.SetSize(total);
|
||||
mcb.SetPSPSeg(dos.psp());
|
||||
DOS_CompressMemory();
|
||||
if (*blocks==total) return true; /* block fit exactly */
|
||||
|
||||
*blocks=total; /* return maximum */
|
||||
|
Loading…
x
Reference in New Issue
Block a user