Open willnationsdev opened 6 years ago
This has something to do with the compilation of the RegEx objects in FilterMenuItem
s during the time inheritance dock initializes config files and sets up filters in the _ready
statement of the Inheritance Dock. If you comment out the _regex.compile
command in the filter_menu_item.gd
script, this memory leak stops happening, but I can't seem to reproduce it in a project that deals with a standalone RegEx object, so it must have something to do with the way I'm using the object(s). And the objects are compiling succesfully. I've confirmed that I don't need to call clear()
beforehand (the source code takes care of that for me).
Maybe this isn't quite a memory leak. The error explicitly says...
ERROR: ResourceCache::clear: Resources Still in use at Exit!
At: core\resource.cpp:418
ERROR: There are still MemoryPool allocs in use at exit!
At: core\dvector.cpp:70
And since it only happens at close, it might have less to do with calling compile itself, and more to do with the fact that the RegEx object is being actively used or triggered during shut down procedures. Which would only happen if the filter menu item's regex_edit node's text property is assigned a value at the same time that the RegEx object is being removed (which would actually make sense).
Perhaps this could be "fixed" by not recompiling the regex unless the user manually clicks on a re-compile button within the FilterMenuItem. That would also prevent the editor from printing "cannot compile, bad regex!" errors every time you type a character into the Regex LineEdit.
Edit: actually, it would be simpler to just have it trigger when the user explicitly clicks "ENTER" while on the LineEdit. Preserves the usability level without auto-triggering regex compilation every time the value is set.
Currently, if you close the editor with the plugin active, you will see error messages. They are some memory leaks in the Inheritance Dock that I need to track down. For now, some errors will show up if you close the editor with the plugin active. (since it clears the resource cache and memory pool regardless.