int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);  
        Log.e("TAG", "Max memory is " + maxMemory + "KB");  
        Log.e("TAG", "Max memory is " + maxMemory /1024 + "MB");  
        Log.e("TAG", "Max memory is " + maxMemory /1024/1024 + "GB");                              

 

//执行结果如下:
/*
    TAG    Max memory is 65536KB
    TAG    Max memory is 64MB
    TAG    Max memory is 0GB
*/

该应用程序被分配的内存大小为 64M