Package android.os

Class Debug.MemoryInfo

  • All Implemented Interfaces:
    Parcelable
    Enclosing class:
    Debug

    public static class Debug.MemoryInfo
    extends Object
    implements Parcelable
    This class is used to retrieved various statistics about the memory mappings for this process. The returned info is broken down by dalvik, native, and other. All results are in kB.
    • Field Detail

      • dalvikPss

        public int dalvikPss
        The proportional set size for dalvik heap. (Doesn't include other Dalvik overhead.)
      • dalvikSwappablePss

        public int dalvikSwappablePss
      • dalvikPrivateDirty

        public int dalvikPrivateDirty
        The private dirty pages used by dalvik heap.
      • dalvikSharedDirty

        public int dalvikSharedDirty
        The shared dirty pages used by dalvik heap.
      • dalvikPrivateClean

        public int dalvikPrivateClean
      • dalvikSharedClean

        public int dalvikSharedClean
      • dalvikSwappedOut

        public int dalvikSwappedOut
      • nativePss

        public int nativePss
        The proportional set size for the native heap.
      • nativeSwappablePss

        public int nativeSwappablePss
      • nativePrivateDirty

        public int nativePrivateDirty
        The private dirty pages used by the native heap.
      • nativeSharedDirty

        public int nativeSharedDirty
        The shared dirty pages used by the native heap.
      • nativePrivateClean

        public int nativePrivateClean
      • nativeSharedClean

        public int nativeSharedClean
      • nativeSwappedOut

        public int nativeSwappedOut
      • otherPss

        public int otherPss
        The proportional set size for everything else.
      • otherSwappablePss

        public int otherSwappablePss
      • otherPrivateDirty

        public int otherPrivateDirty
        The private dirty pages used by everything else.
      • otherSharedDirty

        public int otherSharedDirty
        The shared dirty pages used by everything else.
      • otherPrivateClean

        public int otherPrivateClean
      • otherSharedClean

        public int otherSharedClean
      • otherSwappedOut

        public int otherSwappedOut
      • OTHER_DALVIK_LINEARALLOC

        public static final int OTHER_DALVIK_LINEARALLOC
        See Also:
        Constant Field Values
      • OTHER_DALVIK_ACCOUNTING

        public static final int OTHER_DALVIK_ACCOUNTING
        See Also:
        Constant Field Values
      • OTHER_DALVIK_CODE_CACHE

        public static final int OTHER_DALVIK_CODE_CACHE
        See Also:
        Constant Field Values
      • OTHER_DALVIK_NON_MOVING

        public static final int OTHER_DALVIK_NON_MOVING
        See Also:
        Constant Field Values
      • OTHER_DALVIK_INDIRECT_REFERENCE_TABLE

        public static final int OTHER_DALVIK_INDIRECT_REFERENCE_TABLE
        See Also:
        Constant Field Values
    • Constructor Detail

      • MemoryInfo

        public MemoryInfo()
    • Method Detail

      • getTotalPss

        public int getTotalPss()
        Return total PSS memory usage in kB.
      • getTotalUss

        public int getTotalUss()
      • getTotalSwappablePss

        public int getTotalSwappablePss()
        Return total PSS memory usage in kB.
      • getTotalPrivateDirty

        public int getTotalPrivateDirty()
        Return total private dirty memory usage in kB.
      • getTotalSharedDirty

        public int getTotalSharedDirty()
        Return total shared dirty memory usage in kB.
      • getTotalPrivateClean

        public int getTotalPrivateClean()
        Return total shared clean memory usage in kB.
      • getTotalSharedClean

        public int getTotalSharedClean()
        Return total shared clean memory usage in kB.
      • getTotalSwappedOut

        public int getTotalSwappedOut()
        Return total swapped out memory in kB.
      • getOtherPss

        public int getOtherPss​(int which)
      • getOtherSwappablePss

        public int getOtherSwappablePss​(int which)
      • getOtherPrivateDirty

        public int getOtherPrivateDirty​(int which)
      • getOtherSharedDirty

        public int getOtherSharedDirty​(int which)
      • getOtherPrivateClean

        public int getOtherPrivateClean​(int which)
      • getOtherPrivate

        public int getOtherPrivate​(int which)
      • getOtherSharedClean

        public int getOtherSharedClean​(int which)
      • getOtherSwappedOut

        public int getOtherSwappedOut​(int which)
      • getOtherLabel

        public static String getOtherLabel​(int which)
      • getMemoryStat

        public String getMemoryStat​(String statName)
        Returns the value of a particular memory statistic or null if no such memory statistic exists.

        The following table lists the memory statistics that are supported. Note that memory statistics may be added or removed in a future API level.

        Memory statistic name Meaning Example Supported (API Levels)
        summary.java-heap The private Java Heap usage in kB. This corresponds to the Java Heap field in the App Summary section output by dumpsys meminfo. 1442 23
        summary.native-heap The private Native Heap usage in kB. This corresponds to the Native Heap field in the App Summary section output by dumpsys meminfo. 1442 23
        summary.code The memory usage for static code and resources in kB. This corresponds to the Code field in the App Summary section output by dumpsys meminfo. 1442 23
        summary.stack The stack usage in kB. This corresponds to the Stack field in the App Summary section output by dumpsys meminfo. 1442 23
        summary.graphics The graphics usage in kB. This corresponds to the Graphics field in the App Summary section output by dumpsys meminfo. 1442 23
        summary.private-other Other private memory usage in kB. This corresponds to the Private Other field output in the App Summary section by dumpsys meminfo. 1442 23
        summary.system Shared and system memory usage in kB. This corresponds to the System field output in the App Summary section by dumpsys meminfo. 1442 23
        summary.total-pss Total PPS memory usage in kB. 1442 23
        summary.total-swap Total swap usage in kB. 1442 23
      • getMemoryStats

        public Map<String,​String> getMemoryStats()
        Returns a map of the names/values of the memory statistics that getMemoryStat(String) supports.
        Returns:
        a map of the names/values of the supported memory statistics.
      • getSummaryJavaHeap

        public int getSummaryJavaHeap()
        Pss of Java Heap bytes in KB due to the application. Notes: * OTHER_ART is the boot image. Anything private here is blamed on the application, not the system. * dalvikPrivateDirty includes private zygote, which means the application dirtied something allocated by the zygote. We blame the application for that memory, not the system. * Does not include OTHER_DALVIK_OTHER, which is considered VM Overhead and lumped into Private Other. * We don't include dalvikPrivateClean, because there should be no such thing as private clean for the Java Heap.
      • getSummaryNativeHeap

        public int getSummaryNativeHeap()
        Pss of Native Heap bytes in KB due to the application. Notes: * Includes private dirty malloc space. * We don't include nativePrivateClean, because there should be no such thing as private clean for the Native Heap.
      • getSummaryCode

        public int getSummaryCode()
        Pss of code and other static resource bytes in KB due to the application.
      • getSummaryStack

        public int getSummaryStack()
        Pss in KB of the stack due to the application. Notes: * Includes private dirty stack, which includes both Java and Native stack. * Does not include private clean stack, because there should be no such thing as private clean for the stack.
      • getSummaryGraphics

        public int getSummaryGraphics()
        Pss in KB of graphics due to the application. Notes: * Includes private Gfx, EGL, and GL. * Warning: These numbers can be misreported by the graphics drivers. * We don't include shared graphics. It may make sense to, because shared graphics are likely buffers due to the application anyway, but it's simpler to implement to just group all shared memory into the System category.
      • getSummaryPrivateOther

        public int getSummaryPrivateOther()
        Pss in KB due to the application that haven't otherwise been accounted for.
      • getSummarySystem

        public int getSummarySystem()
        Pss in KB due to the system. Notes: * Includes all shared memory.
      • getSummaryTotalPss

        public int getSummaryTotalPss()
        Total Pss in KB.
      • getSummaryTotalSwap

        public int getSummaryTotalSwap()
        Total Swap in KB. Notes: * Some of this memory belongs in other categories, but we don't know if the Swap memory is shared or private, so we don't know what to blame on the application and what on the system. For now, just lump all the Swap in one place.
      • describeContents

        public int describeContents()
        Description copied from interface: Parcelable
        Describe the kinds of special objects contained in this Parcelable's marshalled representation.
        Specified by:
        describeContents in interface Parcelable
        Returns:
        a bitmask indicating the set of special object types marshalled by the Parcelable.
      • writeToParcel

        public void writeToParcel​(Parcel dest,
                                  int flags)
        Description copied from interface: Parcelable
        Flatten this object in to a Parcel.
        Specified by:
        writeToParcel in interface Parcelable
        Parameters:
        dest - The Parcel in which the object should be written.
        flags - Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.
      • readFromParcel

        public void readFromParcel​(Parcel source)