Apparently a lot of questions have been asked about this but I cannot find the answer, so if this is indeed a duplicate please close this and redirect me to the answer.
I am developing a browser game and am trying to keep allocations to a minimum, by using pre-allocated arrays, not returning objects, avoiding language functions that allocate, using numbers wherever possible, etc.
Despite this, my memory graph in Chrome after doing a 10 second performance recording looks like this:
My question is simple: how can I find out what is causing allocation every frame? Surely there is a better way than just doing a text search on the codebase for the "known suspects" like new
, returning objects from functions, creating new arrays, etc.
Ideally I would also be able to determine what is causing the most allocations and contributing the most to those spikes and sawtooths, so I can start with the low-hanging fruit first. Is this possible?