Memory leak in WPF GDI Control #45
Labels
area-rendering
Everything related to the rendering
🕷️ type-bug
state-accepted
This is a valid topic to work on.
While using the control in a WPF project I ran into various out-of-memory exceptions after rendering several Scores.
It seems like memory for the previous generated bitmap is not released when a new bitmap is generated.
The code below is taken from OnRenderFinished in AlphaTabGdi.cs:
As far as I have understood, the call to bitmap.GetHbitmap() gives a pointer to unmanaged memory that must be freed after use.
I applied the following quick-fix / workaround.
This quick-fix is far from perfect, and memory may probably still leak in some cases, but it solved the problems I were experiencing.
The text was updated successfully, but these errors were encountered: