RESOLVED FIXED 154407
Web Inspector: We should have a way to capture heap snapshots programatically.
https://bugs.webkit.org/show_bug.cgi?id=154407
Summary Web Inspector: We should have a way to capture heap snapshots programatically.
Mark Lam
Reported 2016-02-18 12:50:13 PST
This will come in handy for web devs who need to profile memory usage or detect leaks as a result of executing a certain section of script code. We should also be able to provide a description string to label the snapshot being taken.
Attachments
[PATCH] Proposed Fix (33.14 KB, patch)
2016-03-17 20:42 PDT, Joseph Pecoraro
no flags
[PATCH] Proposed Fix (39.45 KB, patch)
2016-03-17 21:06 PDT, Joseph Pecoraro
timothy: review+
[PATCH] For Landing (39.30 KB, patch)
2016-03-29 11:00 PDT, Joseph Pecoraro
no flags
Radar WebKit Bug Importer
Comment 1 2016-02-18 12:50:50 PST
Joseph Pecoraro
Comment 2 2016-02-18 13:04:03 PST
I'd suggest something like: console.heapSnapshot(name); Which is similar to how we do programmatic JavaScript profiles: console.profile(name) console.profileEnd(name)
Joseph Pecoraro
Comment 3 2016-02-22 15:11:24 PST
Looks like Microsoft already has: <https://msdn.microsoft.com/en-us/library/windows/apps/jj819176(v=vs.120).aspx#SnapshotDetails> console.takeHeapSnapshot So we can use that to be consistent!
Joseph Pecoraro
Comment 4 2016-03-17 20:42:03 PDT
Created attachment 274364 [details] [PATCH] Proposed Fix This adds console.takeHeapSnapshot. It will only work if: 1. The inspector is open 2. The inspector's Timeline tab has the Heap Allocations timeline (currently this is always) NOTE: You do not need to be recording. We may want to provide an alternative, like a Console Message that you can click on to show the snapshot Content View.
Joseph Pecoraro
Comment 5 2016-03-17 21:00:35 PDT
Mozilla bug for this: Implement console.takeHeapSnapshot https://bugzilla.mozilla.org/show_bug.cgi?id=960662 Chrome bug for this: No JavaScript call to trigger a heap snapshot https://bugs.chromium.org/p/chromium/issues/detail?id=31516
Joseph Pecoraro
Comment 6 2016-03-17 21:06:01 PDT
Created attachment 274366 [details] [PATCH] Proposed Fix
Joseph Pecoraro
Comment 7 2016-03-29 11:00:48 PDT
Created attachment 275109 [details] [PATCH] For Landing
WebKit Commit Bot
Comment 8 2016-03-29 11:51:34 PDT
Comment on attachment 275109 [details] [PATCH] For Landing Clearing flags on attachment: 275109 Committed r198786: <http://trac.webkit.org/changeset/198786>
Note You need to log in before you can comment on or make changes to this bug.