Closed Therzok closed 4 years ago
Tentative fix in MD's source copy: https://github.com/mono/monodevelop/commit/a37e74a10335cecbbdea5630a635d3bc5d7896a3 Haven't tested it yet.
If the leak is coming in from EditorOperations instantiation, via ITextBufferUndoManagerProvider. GetTextBufferUndoManager
, something needs to also call .ITextBufferUndoManagerProvider. RemoveTextBufferUndoManager
, along the above tentative fix.
this probably doesn't leak in VS because VS uses its own legacy undo implementation, which is cleared on VS-specific file close code path. Can you please come up with VS for Mac repro steps? Also +@dpugh
Repro steps on VS4Mac are opening a doc, editing a bit, closing a doc. UndoHistoryRegistryImpl.histories
will contain as many instances of ITextUndoHistory
as docs were opened, even if all of them were closed. This causes leaks of undo stacks.
@Therzok if you want, you can submit a PR against this fork/branch: https://github.com/KirillOsenkov/vs-editor-api/tree/FirstRelease
and I can rebuild and publish a new NuGet and insert it into MonoDevelop.
I'm fixing this (same way @Therzok proposed) as part of bigger fix for a leak in LightBulb.
@olegtk https://github.com/KirillOsenkov/vs-editor-api/pull/1 You can just cherry-pick this if you want. We put it in Kirill's fork so we get it in VSMac asap.
Should this be closed?
@DavidKarlas and I will check next week
Hmm, neither of the two fixes here are applied in VS-Platform: https://github.com/KirillOsenkov/vs-editor-api/pull/1/files
@olegtk could you please take a look?
@KirillOsenkov I opened upstream PR just now... Closing. This slipped, because its in Impl and I wasn't paying much attention in that area yet :(
In a few profiling analysis sessions done in VSMac, I have observed that
ITextUndoHistory
is being leaked inUndoHistoryRegistryImpl.histories
Dictionary.From a few quick source greps, I observe that:
UndoHistoryRegistryImpl.RemoveHistory
is only called byTextBufferUndoManager.UnregisterUndoHistory
TextBufferUndoManager.UnregisterUndoHistory
.Thus, all docs will leak an UndoHistoryRegistryImpl.