- Home /
What is the best way to check what parts of my codebase allocate the most?
My codebase is pretty big by now so manual checking is basically out of the question. Always tried to avoid unnecessary allocations, however I am currently experiencing performance issues that I believe roots from too many allocations, too fast (big GC peaks). Using free tools, if possible as I basically have no budget.
Answer by AurimasBlazulionis · Jan 09, 2017 at 06:11 PM
First of all, inside the CPU profiler you can sort by the GC allocations the data.
Later, you will need to use something like Profiler.BeginSample inside your code to find the most GC allocated parts. Just split the code functions into halves, then if needed these halves to another halves. This way you will find the parts you should care about. Another option is to just use deep profile.
Generally, you should search after all of your variable definitions for some types like floats or custom classes etc. and better make some temporary private variables for these.