Since DevEco Studio 6.1.1 Beta1, the ComMemory template has been added to DevEco Profiler for analyzing memory allocation of UI components, helping locate UI component memory leaks.
The ComMemory template supports the following lanes: Memory, ArkUI Snapshot, ArkTS Snapshot, All Heap & Anonymous VM, All Heap, All Anonymous VM, System Resources, and Graphic Memory. This section describes the ArkUI Snapshot lane. For details about other lanes, see the corresponding template.
Before analysis, create a ComMemory analysis task and capture related data. For details, see In-depth Capture for Problem Locating. Alternatively, click Open File in the session area and import historical data.
in the upper-left corner of the task to start a snapshot when necessary. Once the snapshot is complete, a purple block appears in the ArkUI Snapshot lane.The Details panel displays the details of the current snapshot. Click Open to open the corresponding .arkli file in ArkUI Inspector.

Show Component Size and Show Free-Node Components are selected by default. Show Component Size displays the memory usage of each component. Show Free-Node Components displays free-node components (components not in the component tree). Click
and select Show Recursive Size to display the memory usage of subtrees rooted at each component.



The memory field indicates the retained size of the state variable in the ArkTS heap snapshot of the corresponding component. For details, see Viewing State Variables of UI Components.

to export the component tree snapshot containing memory information to local storage.Since version 26.0.0, .arkli files can be compared to quickly identify components with an abnormal increase in count.
in the upper-left corner of the task to start a snapshot when necessary. Once the snapshot is complete, a purple block appears in the ArkUI Snapshot lane.The Details panel displays the details of the current snapshot. Click Open to open the corresponding .arkli file in ArkUI Inspector.

The target file must first be opened in ArkUI Inspector by clicking Open. Otherwise, it will not appear in the drop-down list.
