Creating multiple instances of Scintilla in an application results in a leak of GPU memory. Each time a new instance is created, GPU memory is allocated, and it is never cleaned up when the associated window is destroyed.
This is observable on Windows 10 using the Details tab of the Task Manager with the Dedicated GPU memory column visible.
As I workaround, I disabled DirectWrite, so no additional GPU memory is allocated when new instances are created. However, it does not clean up memory claimed by existing instances.
I ran into this while using the Dolphin Smalltalk IDE, which creates a new Scintilla instance each time a text editor is opened rather than creating multiple documents within a single instance. Since this is a nonstandard use of Scintilla, it may be difficult to reproduce with Scite or Notepad++, but a simple script that creates and destroys multiple instances should suffice?
Can't see anything obvious in the allocation and deallocation of Direct* resources. They are handled through
WRL::ComPtrso should all be released when deleting theScintillaWin.The particular technology setting may affect behaviour with
Technology::DirectWrite1being more complex and with newer code.Sometimes code allocates memory pools which are retained to avoid extra work. Open multiple Scintilla windows then close them and open the same windows again. If there is a similar amount of memory used after the second openings then the use may be of this form.
Sometimes graphics drivers have bugs. The leak should be verified on a machine with a different brand GPU.
Thanks for looking into it.
How do you reopen a window that has already been closed?
The leak happens on a NVIDIA GeForce GT 1030, driver version 32.0.15.6094. I updated it to v32.0.15.8228 and the behaviour doesn't change. The versions are about two years apart.
I'll see if I can find other Dolphin users with different hardware to try and reproduce it.
Last edit: Joseph Betz 4 hours ago