Is it possible to get the sum of the Profiler Memory 'GC Allocations per Frame'?

As the title. I’m talking about the Profiler (Window → Analysis → Profiler), and in that window, the Memory one.

What I’m looking for is to create a C# function that can take a range of frames as input (e.g. frame 161 to 326) and give me the sum of the ‘GC Allocations per Frame’ value from the Memory profiler.

I know about the ProfilerDriver.GetHierarchyFrameDataView() function, but that seems to get the ‘GC alloc’ from the CPU Usage profiler, not the Memory profiler, and seems completely inaccurate (not to mention different from the Memory profiler data). That’s why I’m looking at the Memory profiler row.

Anybody know of a way? My end goal here is to get information (programmatically) about how much total bytes of GC allocations are happening in a certain time period.

2 Likes

What is the difference you see? We record every single GC.Alloc event and increment memory stats synchronously. Do you walk all threads for GC.Alloc events? Sounds like a bug we should fix.
(There is no API atm to extract the GC alloc information specifically.)