How Can Developers Find the Source of Excessive Mono Heap Allocations in Unity?
Deep call stacks can make it difficult to identify which functions are responsible for excessive Mono heap allocations in Unity projects. GameOptim GOT Online introduces reverse call stack analysis for Mono heap memory, bringing the functions responsible for allocations into clearer view. Developers can inspect allocation trends across test versions, examine allocation details, and trace function call relationships to locate potential memory bottlenecks.
Summary Deep call stacks can make it time consuming to locate the specific functions responsible for Mono heap allocations. GOT Online's reverse call stack analysis highlights the child functions associated with the largest Mono heap allocations during gameplay. Developers can compare allocation trends across different test versions and identify functions whose allocation values continue to increase. Detailed allocation data and reverse call stack relationships help developers trace allocations back through the calling hierarchy. Searching for the functions in the first 1–3 levels of the reverse call stack can provide a practical starting point for code level optimization. Why Can Deep Call Stacks Make Mono Heap Allocation Analysis Difficult? Deep call stacks can make it difficult to identify the specific functions responsible for Mono heap allocations. In many game projects, call stacks contain numerous layers, sometimes exceeding 30 levels. Developers may need to expand and inspect multiple levels of the call stack to find the functions responsible for memory allocation. However, functions that appear separately in the original call stack may actually be instances of the same function reached through different calling paths. As a result, developers may spend considerable time expanding call stacks and comparing function information without gaining a clear view of the actual allocation sources. How Does Reverse Call Stack Analysis Help Identify Mono Heap Allocations? GameOptim GOT Online provides a Reverse Call Analysis mode for Mono heap memory analysis. By selecting this mode, developers can view the top child functions responsible for the largest Mono heap allocations during gameplay. Reversing the original allocation call stacks brings these functions into focus, making it easier to identify where allocations originate. Instead of repeatedly expanding deep call stacks, developers can start with the functions associated with the largest allocations and investigate their relationships with other functions. This approach helps development teams narrow down potential Mono heap allocation bottlenecks more efficiently. https://uwa overseas public.oss us east 1.aliyuncs.com/uploads/markdown/f731a26d b5a4 4926 a3c2 cda6d075309e.png How Can Developers Track Mono Heap Allocation Trends Across Test Versions? GOT Online allows developers to select individual child functions and inspect how their allocation values change across different test versions. For example, a report can display the trend in a function's average heap allocation per 10K frames. This makes it possible to examine how the function's allocation behavior changes across tests. Functions whose heap allocations continue to increase deserve closer attention. Development teams can investigate these functions further and use regression testing to help identify and troubleshoot the underlying issues. The trend provides a way to prioritize further investigation rather than relying solely on a single allocation value. How Can Developers Trace Allocations Through the Reverse Call Stack? GOT Online also provides detailed allocation information and reverse call stack data for individual child functions during project testing. In the reverse call stack, expanding a node displays the direct functions that call the function represented by that node and generate heap allocations. Developers can expand these relationships level by level to examine the hierarchy of function calls associated with the allocations. By inspecting both the allocation details and the calling relationships, developers can trace how the relevant functions are connected and better understand where the allocations originate. Which Functions Should Developers Investigate First? GameOptim recommends starting with the functions in the first 1–3 levels of the reverse call stack. Developers can search for these functions directly in the project code and inspect their Mono heap allocation behavior. This provides a practical starting point for code level optimization without requiring them to navigate every level of a deep call stack first. Combined with allocation trends and detailed reverse call stack information, this workflow helps developers focus their investigation on more relevant allocation sources and work toward more efficient code optimization. FAQ What is reverse call stack analysis in GOT Online? Reverse call stack analysis rearranges the original Mono heap allocation call stacks to highlight the child functions responsible for allocations. It helps developers identify relevant functions without repeatedly expanding deep call stacks. Why is it difficult to identify Mono heap allocation sources in Unity? Some game projects have call stacks exceeding 30 levels. Functions reached through different calling paths may also appear separately in the original stack even when they are the same function, making manual inspection time consuming. Can GOT Online show how Mono heap allocations change across test versions? Yes. Developers can select an individual child function and inspect its allocation trend across different test versions. The report can show average heap allocation per 10K frames. How can developers investigate functions with increasing Mono heap allocations? Developers can review the function's allocation trend, examine its detailed allocation information and reverse call stack, and use regression testing to investigate functions whose allocation values continue to increase. Which functions should developers search for first when optimizing Mono heap allocations? GameOptim recommends starting with functions in the first 1–3 levels of the reverse call stack. Developers can search for these functions in the project code and investigate their allocation behavior. Try it New users can get 2 hours of free GOT Online testing time after completing registration. https://www.gameoptim.com/?fopt=blog About GameOptim GOT Online GOT Online is a cloud based performance analysis platform with online performance reports for deeper analysis and collaboration. Based on visualized data display, providing targeted analysis suggestions and performance parameter trends, facilitating efficient quality control execution. To meet a wide range of optimization needs, GOT Online provides four major analysis modes: • Overall Performance Analysis • Mono Heap Memory Analysis • Lua Performance Analysis • GPU Performance Analysis