Detect application heap size in Android

后端 未结 9 1965
-上瘾入骨i
-上瘾入骨i 2020-11-22 07:38

How do you programmatically detect the application heap size available to an Android app?

I heard there\'s a function that does this in later versions of the SDK. In

9条回答
  •  花落未央
    2020-11-22 08:06

    Debug.getNativeHeapSize() will do the trick, I should think. It's been there since 1.0, though.

    The Debug class has lots of great methods for tracking allocations and other performance concerns. Also, if you need to detect a low-memory situation, check out Activity.onLowMemory().

提交回复
热议问题