Home > Mobile >  How android applications for current can get the biggest footprint
How android applications for current can get the biggest footprint

Time:09-27

Because demand is said to meet maximum pixel image rendering, but a larger load need more memory, so I must need to make a judgment and prevent oom, surfing the web, found by the following code can get the maximum available memory app
 public static float getMaxMemory () {
Return the Runtime. GetRuntime (). MaxMemory ()/1024 f/1024 f.
}
 public static ActivityManager. MemoryInfo getMemoryInfo (Context Context) {
If (the context==null) {
return null;
}
ActivityManager. MemoryInfo mi=new ActivityManager. MemoryInfo ();
((ActivityManager) context. GetSystemService (context. ACTIVITY_SERVICE)). GetMemoryInfo (mi);
Return the mi;
}
 val manager=(enclosing getSystemService (Context. ACTIVITY_SERVICE) as ActivityManager) 
Val heapGrowthLimit=manager. MemoryClass

After tests found that the return of maximum available memory is 512 m, but, I in the Android Studio by looking at the inside of the profiler memory module, you can see my app has more than 1 gb of memory
Clear and 512 m not ah, that what can get the largest number of memory?

CodePudding user response:

Mobile phone deposit is 8 g
  • Related