%SUBJ%
Can we do something like this as a short term solution? JSGlobalData* globalData = JSDOMWindow::commonJSGlobalData(); Statistics statistics = globalData->heap.statistics(); Use statistics.size & statistics.free? It'll traverse heap, but is there anything that works faster for you guys?
I think it's better not to traverse the heap. In the worst case, the heap traversal can be more expensive than the page load itself, so there's a big risk of measurement overhead ruining the timeline. How about just using m_heap.usedBlocks * BLOCK_SIZE? That's a constant-time measurement of the size of the heap, which should be good enough for general measurement. (statistics() goes farther and gets exact counts of what's live and dead, but that's really only useful for debugging memory leaks in WebKit.) There's no current accessor for m_heap.usedBlocks * BLOCK_SIZE, but it would be trivial to add one. size_t Heap::size() // In bytes. { return m_heap.usedBlocks * BLOCK_SIZE; }
Created attachment 56064 [details] [patch] initial version. I've made recommended implementation. But from the other hand I've made some investigation and found that the heap traversing is eating not more than 0.1 ms for 60mb heap.
Attachment 56064 [details] did not build on gtk: Build output: http://webkit-commit-queue.appspot.com/results/2282074
Created attachment 56068 [details] [patch] second iteration. With fixed case of JSDOMWindow.h
Comment on attachment 56068 [details] [patch] second iteration. With fixed case of JSDOMWindow.h r=me That .1ms number is interesting. Perhaps we should reconsider the heap traversal option if there's a big benefit in terms of WebInspector UI.
Comment on attachment 56068 [details] [patch] second iteration. With fixed case of JSDOMWindow.h Clearing flags on attachment: 56068 Committed r59526: <http://trac.webkit.org/changeset/59526>
All reviewed patches have been landed. Closing bug.