1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-31 01:20:37 -08:00

Purge spare committed memory when growing the arena fails due to the commit limit.

Copied from Perforce
 Change: 189362
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Richard Brooksby 2016-02-26 18:58:34 +00:00
parent c47a41d163
commit ef17ba047b

View file

@ -77,6 +77,14 @@ Res PolicyAlloc(Tract *tractReturn, Arena arena, LocusPref pref,
/* Plan C: Extend the arena, then try A and B again. */
if (moreZones != ZoneSetEMPTY) {
res = arena->class->grow(arena, pref, size);
/* If we can't extent because we hit the commit limit, try purging
some spare committed memory and try again.*/
/* TODO: This would be a good time to *remap* VM instead of
returning it to the OS. */
if (res == ResCOMMIT_LIMIT) {
if (arena->class->purgeSpare(arena, size) >= size)
res = arena->class->grow(arena, pref, size);
}
if (res != ResOK)
return res;
if (zones != ZoneSetEMPTY) {