melatonin_perfetto icon indicating copy to clipboard operation
melatonin_perfetto copied to clipboard

Blank traces when allocated memory is used up

Open sudara opened this issue 2 years ago • 3 comments
trafficstars

If you have perfetto enabled and run the program too long, it eats through all of peretto's allocated memory.

There's no warning, just the .pftrace file ends up not loading (blank screen) when you got to import it at the trace viewer at https://perfetto.dev

I haven't looked into perfetto proper to see if there's a way to change this behavior.

Perhaps there's a supported way that we could cleanly end the trace when the memory is used.

Or maybe there's API that we could periodically query to at least warn the user via DBG or something that the trace is corrupted.

Or maybe this is a bug with perfetto?

sudara avatar Dec 12 '22 13:12 sudara

It seems to me that this is a Perfetto bug, but if you'd like me to I can spend some time looking into it.

benthevining avatar Dec 12 '22 19:12 benthevining

It seems like the expected default behavior is the buffer should be a ring buffer https://github.com/google/perfetto/blob/2b1f16731730196ee2c5c55ef2c481dba27da56b/docs/concepts/config.md?plain=1#LL112C3-L112C14

This sounds like a similar description of the problem: https://github.com/google/perfetto/issues/231#issuecomment-1017798965

Could switch to the discard policy by default, I guess. Odd that the default behavior is to brick the trace entirely...

sudara avatar Dec 13 '22 12:12 sudara

Right now this max's out at 105MB.

sudara avatar Jul 15 '23 11:07 sudara