You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been working with an application which requires multiple GameWindow instances to be opened during runtime. It works well, except for unexpected memory leaks when old GameWindow instances are closed and disposed of. It seems as though every instance of GameWindow has a reference in OpenTK.Platform.Windows.WinFactory, and this is not disposed of even when every GameWindow is closed.
Repro steps
Step 1: Create a new instance of GameWindow during the runtime of an application (e.g. a Winform in this case)
Step 2: Close the GameWindow, and dispose of it.
Step 3: Repeat steps 1 and 2 multiple times, then take a memory snapshot. You'll find instances of GameWindow still alive, and still using memory.
Here's a code snippet which reproduces this problem:
for (int i = 0; i < 6; i++)
{
GameWindow window = new GameWindow();
using (window)
{
window.Run(60);
}
window.Dispose();
}
GC.WaitForPendingFinalizers();
Expected behavior
All memory released by GameWindow after it goes out of scope.
Actual behavior
Many instances of GameWindow are left in memory, causing a leak - this isn't too significant with empty GameWindows, but when these instances contain real data the memory piles up.
Related information
Operating system: Windows 10
Native backend
Nuget OpenTK 3.3.3
.NET Framework 4.8
The text was updated successfully, but these errors were encountered:
Description
I've been working with an application which requires multiple GameWindow instances to be opened during runtime. It works well, except for unexpected memory leaks when old GameWindow instances are closed and disposed of. It seems as though every instance of GameWindow has a reference in OpenTK.Platform.Windows.WinFactory, and this is not disposed of even when every GameWindow is closed.
Repro steps
Step 1: Create a new instance of GameWindow during the runtime of an application (e.g. a Winform in this case)
Step 2: Close the GameWindow, and dispose of it.
Step 3: Repeat steps 1 and 2 multiple times, then take a memory snapshot. You'll find instances of GameWindow still alive, and still using memory.
Here's a code snippet which reproduces this problem:
Expected behavior
All memory released by GameWindow after it goes out of scope.
Actual behavior
Many instances of GameWindow are left in memory, causing a leak - this isn't too significant with empty GameWindows, but when these instances contain real data the memory piles up.
Related information
The text was updated successfully, but these errors were encountered: