Heap snapshot and allocations in console API?

114 views
Skip to first unread message

Joe Whitfield-Seed

unread,
Jan 12, 2015, 11:21:49 AM1/12/15
to google-chrome-...@googlegroups.com
It is currently possible to control timeline and CPU profile recording from the console API. Is it possible to do the same for heap snapshots and heap allocations?

Possible API to start discussion:

console.snapshot([label])
console.allocation([label])
console.allocationEnd()

allocation/allocationEnd are not great method names but they are consistent with the style of the timeline and profile methods. recordHeapAllocations/stopRecordingHeapAllocations are more explicit but unweildy, and quite incongruous with the console API's terse method names. I am sure there are better names for each of these methods.

If this sounds feasible I will raise a feature request on crbug. I would be interested in contributing a patch.

Joe Whitfield-Seed

unread,
Jan 12, 2015, 11:39:42 AM1/12/15
to google-chrome-...@googlegroups.com
I forgot to mention my use case:

I built a testcase to bugfix a memory leak. For about 2 hours, my development process was:

1. Reload
2. Start recording allocations
3. Click "make me leak" to trigger a few leaks. Watch the blue bars stack up.
4. Stop recording
5. Repeat

And the occasional pair of heap snapshots.

If heap snapshots/allocations could be automated I could spend less time clicking, more time analysing. Increased precision (i.e. recording profiles around specific lines of code) would be another benefit.

Yury Semikhatsky

unread,
Jan 12, 2015, 12:20:10 PM1/12/15
to Google Chrome Developer Tools
On Mon, Jan 12, 2015 at 7:21 PM, Joe Whitfield-Seed <joes...@gmail.com> wrote:
It is currently possible to control timeline and CPU profile recording from the console API. Is it possible to do the same for heap snapshots and heap allocations?

No. There is no such API at the moment.
 
Possible API to start discussion:

console.snapshot([label])
console.allocation([label])
console.allocationEnd()

allocation/allocationEnd are not great method names but they are consistent with the style of the timeline and profile methods. recordHeapAllocations/stopRecordingHeapAllocations are more explicit but unweildy, and quite incongruous with the console API's terse method names. I am sure there are better names for each of these methods.

If this sounds feasible I will raise a feature request on crbug. I would be interested in contributing a patch.

Please file a feature request on this at crbug.com. I think it may make more sense to reuse existing API like console.timeStamp([label]) for this purposes: force GC on console.timeStamp if allocation tracking is on and add a marker event to the recorded profile so that we could see later it on the heap graph.
 

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/44340c22-5121-458d-ac0e-d9d4aaa11490%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joe Whitfield-Seed

unread,
Jan 13, 2015, 9:53:35 AM1/13/15
to google-chrome-...@googlegroups.com


On Monday, 12 January 2015 17:20:10 UTC, Yury Semikhatsky wrote:
On Mon, Jan 12, 2015 at 7:21 PM, Joe Whitfield-Seed <joes...@gmail.com> wrote:
It is currently possible to control timeline and CPU profile recording from the console API. Is it possible to do the same for heap snapshots and heap allocations?

No. There is no such API at the moment.
 
Possible API to start discussion:

console.snapshot([label])
console.allocation([label])
console.allocationEnd()

allocation/allocationEnd are not great method names but they are consistent with the style of the timeline and profile methods. recordHeapAllocations/stopRecordingHeapAllocations are more explicit but unweildy, and quite incongruous with the console API's terse method names. I am sure there are better names for each of these methods.

If this sounds feasible I will raise a feature request on crbug. I would be interested in contributing a patch.

Please file a feature request on this at crbug.com. I think it may make more sense to reuse existing API like console.timeStamp([label]) for this purposes: force GC on console.timeStamp if allocation tracking is on and add a marker event to the recorded profile so that we could see later it on the heap graph.
 

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-developer-tools+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages