Skip to content

Commit a401908

Browse files
committed
fix: Fixed leak warning being showed when memory pools are full
1 parent 28bf1cc commit a401908

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Ruffles/Memory/MemoryManager.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ internal void DeAlloc(HeapMemory memory)
192192
{
193193
// Failed to enqueue memory. Queue is full
194194
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]");
195+
196+
// Mark as released to prevent leak warnings. This is an intentional leak.
197+
memory.ReleasedToGC = true;
195198
}
196199
}
197200

@@ -211,6 +214,9 @@ internal void DeAlloc(HeapPointers pointers)
211214
{
212215
// Failed to enqueue pointers. Queue is full
213216
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]");
217+
218+
// Mark as released to prevent leak warnings. This is an intentional leak.
219+
pointers.ReleasedToGC = true;
214220
}
215221
}
216222

@@ -230,6 +236,9 @@ internal void DeAlloc(MemoryWrapper wrapper)
230236
{
231237
// Failed to enqueue pointers. Queue is full
232238
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]");
239+
240+
// Mark as released to prevent leak warnings. This is an intentional leak.
241+
wrapper.ReleasedToGC = true;
233242
}
234243
}
235244

0 commit comments

Comments
 (0)