Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1090 from MartinNowak/fixup1081
Browse files Browse the repository at this point in the history
allocating a pool must be done in the if (disabled) block
  • Loading branch information
rainers committed Jan 9, 2015
2 parents 5a91141 + 28676c3 commit 1b9ab11
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/gc/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -2084,11 +2084,14 @@ struct Gcx

if (!tryAlloc())
{
// disabled => allocate a new pool instead of collecting
if (disabled && !newPool(1, false))
if (disabled)
{
// disabled but out of memory => try to free some memory
fullcollect();
// disabled => allocate a new pool instead of collecting
if (!newPool(1, false))
{
// disabled but out of memory => try to free some memory
fullcollect();
}
}
else if (fullcollect() < npools * ((POOLSIZE / PAGESIZE) / 8))
{
Expand Down Expand Up @@ -2146,12 +2149,15 @@ struct Gcx

if (!tryAlloc())
{
// disabled => allocate a new pool instead of collecting
if (disabled && !tryAllocNewPool())
if (disabled)
{
// disabled but out of memory => try to free some memory
fullcollect();
minimize();
// disabled => allocate a new pool instead of collecting
if (!tryAllocNewPool())
{
// disabled but out of memory => try to free some memory
fullcollect();
minimize();
}
}
else
{
Expand Down

0 comments on commit 1b9ab11

Please sign in to comment.