Menu

#2506 Dedicated GPU memory isn't cleaned up when Scintilla instances are destroyed

Bug
open
nobody
5
1 day ago
5 days ago
Joseph Betz
No

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?

1 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 5 days ago

    Can't see anything obvious in the allocation and deallocation of Direct* resources. They are handled through WRL::ComPtr so should all be released when deleting the ScintillaWin.

    The particular technology setting may affect behaviour with Technology::DirectWrite1 being 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.

     
  • Joseph Betz

    Joseph Betz - 1 day ago

    Can't see anything obvious in the allocation and deallocation of Direct* resources. They are handled through WRL::ComPtr so should all be released when deleting the ScintillaWin.

    Thanks for looking into it.

    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.

    How do you reopen a window that has already been closed?

    Sometimes graphics drivers have bugs. The leak should be verified on a machine with a different brand GPU.

    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

Log in to post a comment.

MongoDB Logo MongoDB