Memory leaks and optimizations

Memory leaks and optimizations




=====================

Overview Memory allocated through interfaces in the UnityEngine namespace will be allocated in the Native heap
through Unity through the System namespace The memory allocated by the interface in , will be allocated in the Mono heap through Mono Runtime.


Resources.UnloadUnusedAssets()//Include gc
GC.Collect()



Mono memory is divided into two parts, used memory (used) and heap memory (heap) ,
the used memory refers to the memory that mono actually needs to use, and the
heap memory refers to the memory that mono applies to the operating system. The difference between the two is the free memory of mono.

When mono needs to allocate memory, it will first check whether the free memory is enough.
If it is enough, allocate it directly in the free memory,
otherwise mono will perform a GC to release more free memory.

If there is still not enough free memory after GC, Then mono will apply for memory from the operating system and expand the heap memory =================================================================================================================================================================================================================================================================================================================================================



Use comparetag Resources.FindObjectsOfTypeAll() to dump resources. You can dump textures, materials, models, or other resource types according to your needs. You only need to pass in Type as a parameter. Dump











After success, we save the result as a text file, so that we can use Beyond Compare to compare the results after multiple dumps and find new resources. Then these resources are potential

leak objects and need to be tracked down.



wetest (apk, upload apk, cube (no root))
===
uwa
===
Unity eaglEEye performance analysis platform application case
===
bugly
===
github unity- memory profiler
===
assetbundle browser





====== ==============quote I


believe that all programmers have heard the term memory leak more or less, but for some novice apes, they may not understand it very well. Memory leak? Did the memory leak?

Is it the same as domineering side leak ? Let's first look at the definition of wikipedia
https://blog.csdn.net/wetest_tencent/article/details/52318607

====

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326047137&siteId=291194637