Skip to content

Commit

Permalink
fix: Fixed leak warning being showed when memory pools are full
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoTenPvP committed Sep 25, 2020
1 parent 28bf1cc commit a401908
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Ruffles/Memory/MemoryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ internal void DeAlloc(HeapMemory memory)
{
// Failed to enqueue memory. Queue is full
if (Logging.CurrentLogLevel <= LogLevel.Warning) Logging.LogWarning("Could not return heap memory. The queue is full. The memory will be given to the garbage collector. [HEAP MEMORY]");

// Mark as released to prevent leak warnings. This is an intentional leak.
memory.ReleasedToGC = true;
}
}

Expand All @@ -211,6 +214,9 @@ internal void DeAlloc(HeapPointers pointers)
{
// Failed to enqueue pointers. Queue is full
if (Logging.CurrentLogLevel <= LogLevel.Warning) Logging.LogWarning("Could not return heap pointers. The queue is full. The memory will be given to the garbage collector. [HEAP POINTERS]");

// Mark as released to prevent leak warnings. This is an intentional leak.
pointers.ReleasedToGC = true;
}
}

Expand All @@ -230,6 +236,9 @@ internal void DeAlloc(MemoryWrapper wrapper)
{
// Failed to enqueue pointers. Queue is full
if (Logging.CurrentLogLevel <= LogLevel.Warning) Logging.LogWarning("Could not return memory wrapper. The queue is full. The memory will be given to the garbage collector. [MEMORY WRAPPER]");

// Mark as released to prevent leak warnings. This is an intentional leak.
wrapper.ReleasedToGC = true;
}
}

Expand Down

0 comments on commit a401908

Please sign in to comment.