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.
<rdar://problem/24726292>
I'd suggest something like: console.heapSnapshot(name); Which is similar to how we do programmatic JavaScript profiles: console.profile(name) console.profileEnd(name)
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!
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.
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
Created attachment 274366 [details] [PATCH] Proposed Fix
Created attachment 275109 [details] [PATCH] For Landing
Comment on attachment 275109 [details] [PATCH] For Landing Clearing flags on attachment: 275109 Committed r198786: <http://trac.webkit.org/changeset/198786>