RESOLVED FIXED 29891
Web Inspector: Introduce inspected object groups for console and watch evaluation results so that they could be released explicitly.
https://bugs.webkit.org/show_bug.cgi?id=29891
Summary Web Inspector: Introduce inspected object groups for console and watch evalua...
Pavel Feldman
Reported 2009-09-29 12:46:35 PDT
Currently console and watch evaluation results are wrapped with InspectorController::wrapObject. wrapObject caches the results in the inspector controller. We clean it up upon clearConsole. Originally, wrapObject was only applied to console evaluation results, so that implementation was correct. However, now watch expressions now use same method, while their lifetime does not depend on console. As a result we leak memory on every watch expressions update.
Attachments
patch (18.75 KB, patch)
2009-09-29 12:57 PDT, Pavel Feldman
timothy: review-
patch with review comments addressed (18.79 KB, patch)
2009-10-04 00:29 PDT, Pavel Feldman
timothy: review+
Pavel Feldman
Comment 1 2009-09-29 12:57:39 PDT
Timothy Hatcher
Comment 2 2009-10-03 16:21:49 PDT
Comment on attachment 40318 [details] patch > + for (Vector<String>::iterator it = groupIt->second.begin(); it != groupIt->second.end(); ++it) { > + m_idToWrappedObject.remove(*it); > + } No need for braces here. Does find really return all objects found? I thought it just found the first and returned an iterator for that location for fast removal. I think this code will remove the found object and everything after it. But I might be wrong. r- for now.
Pavel Feldman
Comment 3 2009-10-03 23:03:43 PDT
(In reply to comment #2) > (From update of attachment 40318 [details]) > > > + for (Vector<String>::iterator it = groupIt->second.begin(); it != groupIt->second.end(); ++it) { > > + m_idToWrappedObject.remove(*it); > > + } > > No need for braces here. Does find really return all objects found? I thought > it just found the first and returned an iterator for that location for fast > removal. I think this code will remove the found object and everything after > it. > > But I might be wrong. r- for now. m_objectGroups contains a mapping from object group id to a Vector of values. The loop here is iterating over groupIt->second which is that vector and releases all the objects from another map (objectId -> ScriptObject one). Then it removes this single entry from m_objectGroups.
Pavel Feldman
Comment 4 2009-10-04 00:29:14 PDT
Created attachment 40592 [details] patch with review comments addressed
Pavel Feldman
Comment 5 2009-10-05 01:57:24 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ... M WebCore/ChangeLog M WebCore/bindings/js/JSInspectorBackendCustom.cpp M WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp M WebCore/inspector/InspectorBackend.cpp M WebCore/inspector/InspectorBackend.h M WebCore/inspector/InspectorBackend.idl M WebCore/inspector/InspectorController.cpp M WebCore/inspector/InspectorController.h M WebCore/inspector/InspectorFrontend.cpp M WebCore/inspector/front-end/ConsoleView.js M WebCore/inspector/front-end/InjectedScript.js M WebCore/inspector/front-end/ScriptsPanel.js M WebCore/inspector/front-end/WatchExpressionsSidebarPane.js Committed r49084
Note You need to log in before you can comment on or make changes to this bug.