RESOLVED FIXED 69744
Web Inspector: small memory leak in scripts panel
https://bugs.webkit.org/show_bug.cgi?id=69744
Summary Web Inspector: small memory leak in scripts panel
Ilya Tikhonovsky
Reported 2011-10-10 00:16:29 PDT
Scripts panel doesn't clean the list of child views.
Attachments
Patch (2.96 KB, patch)
2011-10-10 00:19 PDT, Ilya Tikhonovsky
no flags
Patch (2.03 KB, patch)
2011-10-10 01:39 PDT, Ilya Tikhonovsky
no flags
Patch (4.00 KB, patch)
2011-10-10 02:33 PDT, Ilya Tikhonovsky
no flags
Ilya Tikhonovsky
Comment 1 2011-10-10 00:19:39 PDT
Yury Semikhatsky
Comment 2 2011-10-10 00:49:58 PDT
Comment on attachment 110334 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=110334&action=review > Source/WebCore/inspector/front-end/Panel.js:100 > + WebInspector.View.prototype.reset.call(this); This may well break some panels. We shouldn't remove all child views on reset I think. Can you do this clean-up in the ScriptsPanel for now? > Source/WebCore/inspector/front-end/View.js:158 > + reset: function() I'd rather renamed this to something like removeAllChildView
Andrey Kosyakov
Comment 3 2011-10-10 01:06:02 PDT
Comment on attachment 110334 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=110334&action=review > Source/WebCore/inspector/front-end/View.js:165 > + for (var i = 0; i < this._children.length; ++i) { > + var view = this._children[i]; > + view._parentView = null; > + view._detach(); > + } > + this._children = []; We shouldn't destroy view hierarchy upon reset, reset is a model event that typically causes model objects be removed, but does not necessarily affect UI objects (consider NetworkLogView, which is not removed upon reset(), although may be cleaned). There does not seem to be a valid reason for View.reset() to exist at all. I suggest we rather handler view removal in the higher-level code, symmetrical to how the particular view is created.
Ilya Tikhonovsky
Comment 4 2011-10-10 01:39:45 PDT
Andrey Kosyakov
Comment 5 2011-10-10 01:45:51 PDT
Comment on attachment 110337 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=110337&action=review > Source/WebCore/inspector/front-end/ScriptsPanel.js:569 > + this._detachSourceFramesViews(); Why don't we get an event upon script removal from the model instead? We already have UISourceCodeAdded and UISourceCodeReplaced, it would seem natural to have UISourceCodeRemoved. Besides, DebuggerPresentationModel already handles reset event and cleans up the source code accordingly.
Ilya Tikhonovsky
Comment 6 2011-10-10 02:33:15 PDT
Andrey Kosyakov
Comment 7 2011-10-10 02:34:17 PDT
Comment on attachment 110342 [details] Patch LGTM
Yury Semikhatsky
Comment 8 2011-10-10 02:39:57 PDT
Comment on attachment 110342 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=110342&action=review > Source/WebCore/inspector/front-end/DebuggerPresentationModel.js:435 > + this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, this._rawSourceCode[id].sourceMapping.uiSourceCode); Pavel Podivilov was going to allow for multiple UISourceCode's per single RawSourceCode, but I assume it is not landed yet. Also we may want to introduce something like UISourceCodesCleared event for performance reasons., but for now this approach is fine.
Ilya Tikhonovsky
Comment 9 2011-10-10 02:53:12 PDT
Csaba Osztrogonác
Comment 10 2011-10-10 03:55:46 PDT
Csaba Osztrogonác
Comment 11 2011-10-10 03:56:08 PDT
Comment on attachment 110342 [details] Patch remove r+ from landed patch
Csaba Osztrogonác
Comment 12 2011-10-10 05:49:31 PDT
Note You need to log in before you can comment on or make changes to this bug.