I'm having an issue with memory leaks when I create (and later dispose) a temporary SyntaxEditor object.
This object is created programatically at runtime - with no UI, no triggers, no outlining, etc.
It is then used to perform some parsing and is then disposed.
(while allowing the user to continue to edit the 'real' editor)
The new profiling tools in VS2015 showed that the leak was caused by a Document object and thousands of DynamicToken objects.
I found that by adding
editor.Document.Dispose()
before
editor.Dispose()
the leak was reduced by about 30%, with virtually all the remaining leak related to DynamicToken objects and their related LexicalPatterns .
Since there is one and only one Document per editor it seems that this should be taken care of by disposing the editor itself - but apparently it is not.
My real question is how do I get rid of all those DynamicToken objects.
The profiler shows the reference tree to these objects as:
Document
TokenCollection
ArrayList
DynamicToken
Thanks
Mike