RESOLVED FIXED 101085
Web Inspector: Fix heap snapshots counted several times by NMI
https://bugs.webkit.org/show_bug.cgi?id=101085
Summary Web Inspector: Fix heap snapshots counted several times by NMI
Alexei Filippov
Reported 2012-11-02 12:14:02 PDT
Created attachment 172105 [details] screenshot Heap snapshots data size is counted twice. See the attached screenshot. The heap snapshot data is actually takes 208MB, but NMI reports 416MB. To reproduce just open the profiler, take a heap snapshot and look at the native memory chart.
Attachments
screenshot (88.59 KB, image/png)
2012-11-02 12:14 PDT, Alexei Filippov
no flags
Patch (2.29 KB, patch)
2012-11-02 12:22 PDT, Alexei Filippov
no flags
Patch (3.18 KB, patch)
2012-11-07 10:22 PST, Alexei Filippov
no flags
Patch (4.20 KB, patch)
2012-11-08 05:52 PST, Alexei Filippov
no flags
Alexei Filippov
Comment 1 2012-11-02 12:22:29 PDT
Ilya Tikhonovsky
Comment 2 2012-11-03 00:27:13 PDT
Comment on attachment 172107 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=172107&action=review > Source/WebCore/ChangeLog:4 > + Web Inspector: Fix heap snapshots counted several times by NMI > + https://bugs.webkit.org/show_bug.cgi?id=101085 It is not clear for me what was the case.
Ilya Tikhonovsky
Comment 3 2012-11-03 00:29:28 PDT
(In reply to comment #2) > (From update of attachment 172107 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=172107&action=review > > > Source/WebCore/ChangeLog:4 > > + Web Inspector: Fix heap snapshots counted several times by NMI > > + https://bugs.webkit.org/show_bug.cgi?id=101085 > > It is not clear for me what was the case. I mean what was the mechanic of this double counting.
Yury Semikhatsky
Comment 4 2012-11-05 21:41:39 PST
Comment on attachment 172107 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=172107&action=review > Source/WebCore/inspector/InspectorProfilerAgent.cpp:510 > + static ScriptProfilerSingletonProxy scriptProfilerSingletonProxy; static variable will not work for workers.
Alexei Filippov
Comment 5 2012-11-06 04:00:06 PST
Comment on attachment 172107 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=172107&action=review >>> Source/WebCore/ChangeLog:4 >>> + https://bugs.webkit.org/show_bug.cgi?id=101085 >> >> It is not clear for me what was the case. > > I mean what was the mechanic of this double counting. There are two instances of InspectorProfilerAgent, so addPrivateBuffer is called twice. >> Source/WebCore/inspector/InspectorProfilerAgent.cpp:510 >> + static ScriptProfilerSingletonProxy scriptProfilerSingletonProxy; > > static variable will not work for workers. Sorry, could you please elaborate. Why not?
Yury Semikhatsky
Comment 6 2012-11-07 04:34:59 PST
Comment on attachment 172107 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=172107&action=review >>> Source/WebCore/inspector/InspectorProfilerAgent.cpp:510 >>> + static ScriptProfilerSingletonProxy scriptProfilerSingletonProxy; >> >> static variable will not work for workers. > > Sorry, could you please elaborate. Why not? The profiler agent can belong to a dedicated worker that lives on its own thread and ScriptProfilerSingletonProxy can be called concurrently.
Alexei Filippov
Comment 7 2012-11-07 05:44:25 PST
Comment on attachment 172107 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=172107&action=review >>>> Source/WebCore/inspector/InspectorProfilerAgent.cpp:510 >>>> + static ScriptProfilerSingletonProxy scriptProfilerSingletonProxy; >>> >>> static variable will not work for workers. >> >> Sorry, could you please elaborate. Why not? > > The profiler agent can belong to a dedicated worker that lives on its own thread and ScriptProfilerSingletonProxy can be called concurrently. Yes, but this class is an empty POD that has neither constructor nor destructor. I think empty functions can be considered thread safe. I don't want to use DEFINE_STATIC_LOCAL here because in this case its initialization with a heap object may cause a real race condition leading two objects being allocated. I can see hundreds of function static data used across WebKit without DEFINE_STATIC_LOCAL.
Alexei Filippov
Comment 8 2012-11-07 10:22:12 PST
Ilya Tikhonovsky
Comment 9 2012-11-07 23:17:53 PST
Comment on attachment 172829 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=172829&action=review > Source/WebCore/bindings/v8/V8PerIsolateData.cpp:128 > + > + ScriptProfilerInstrumentationProxy scriptProfilerInstrumentationProxy; > + info.addMember(scriptProfilerInstrumentationProxy); it looks like a hack. I'd rather add objectType parameter with default value 0 to addPrivateBuffer method.
Yury Semikhatsky
Comment 10 2012-11-07 23:18:51 PST
(In reply to comment #9) > (From update of attachment 172829 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=172829&action=review > > > Source/WebCore/bindings/v8/V8PerIsolateData.cpp:128 > > + > > + ScriptProfilerInstrumentationProxy scriptProfilerInstrumentationProxy; > > + info.addMember(scriptProfilerInstrumentationProxy); > > it looks like a hack. > I'd rather add objectType parameter with default value 0 to addPrivateBuffer method. Sounds like the second approach we discussed with Alexei, let's implement it instead.
Yury Semikhatsky
Comment 11 2012-11-07 23:19:07 PST
Comment on attachment 172829 [details] Patch r- per Ilya's comment
Alexei Filippov
Comment 12 2012-11-08 05:52:11 PST
WebKit Review Bot
Comment 13 2012-11-09 01:51:26 PST
Comment on attachment 173022 [details] Patch Clearing flags on attachment: 173022 Committed r134033: <http://trac.webkit.org/changeset/134033>
WebKit Review Bot
Comment 14 2012-11-09 01:51:31 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.