1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-23 04:53:12 -08:00

Adding necessary commit-limit check to vmsegalloc _before_ attempting allocation, change.epcore.anchovy.160132

Copied from Perforce
 Change: 20010
 ServerID: perforce.ravenbrook.com
This commit is contained in:
David Jones 1998-09-09 12:50:14 +01:00
parent 705c0f81bd
commit 7ee236ee51

View file

@ -1,6 +1,6 @@
/* impl.c.arenavm: VIRTUAL MEMORY BASED ARENA IMPLEMENTATION
*
* $HopeName: MMsrc!arenavm.c(trunk.53) $
* $HopeName: MMsrc!arenavm.c(trunk.54) $
* Copyright (C) 1998. Harlequin Group plc. All rights reserved.
*
* PURPOSE
@ -32,7 +32,7 @@
#include "mpm.h"
#include "mpsavm.h"
SRCID(arenavm, "$HopeName: MMsrc!arenavm.c(trunk.53) $");
SRCID(arenavm, "$HopeName: MMsrc!arenavm.c(trunk.54) $");
/* @@@@ Arbitrary calculation for the maximum number of distinct */
@ -1294,6 +1294,13 @@ static Res VMSegAlloc(Seg *segReturn, SegPref pref, Size size,
/* must be non-NULL. */
AVER(pool != NULL);
/* SegAlloc will necessarily increase committed by size */
/* (possibly more) so check that first. */
if(vmArena->committed + size > arena->commitLimit ||
vmArena->committed + size < vmArena->committed) {
return ResCOMMIT_LIMIT;
}
if(!VMSegFind(&baseIndex, &chunk, vmArena, pref, size, FALSE)) {
VMArenaChunk newChunk;
Size chunkSize;