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

Commit

Permalink
allocating a pool must be done in the if (disabled) block
Browse files Browse the repository at this point in the history
- or the else branch gets executed on a successful pool allocation
  • Loading branch information
MartinNowak committed Jan 8, 2015
1 parent 5a91141 commit 28676c3
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 28676c3

Please sign in to comment.