| 2027 | private static Debug.MemoryInfo info = new Debug.MemoryInfo(); |
| 2028 | private static Field[] infoFields = Debug.MemoryInfo.class.getFields(); |
| 2029 | private static String dumpFields( Field[] fields, Object obj) { |
| 2030 | StringBuilder buf = new StringBuilder(); |
| 2031 | try { |
| 2032 | for ( Field f : fields ) { |
| 2033 | if ( buf.length()>0 ) |
| 2034 | buf.append(", "); |
| 2035 | buf.append(f.getName()); |
| 2036 | buf.append("="); |
| 2037 | buf.append(f.get(obj)); |
| 2038 | } |
| 2039 | } catch ( Exception e ) { |
| 2040 | |
| 2041 | } |
| 2042 | return buf.toString(); |
| 2043 | } |
| 2044 | public static void dumpHeapAllocation() { |
| 2045 | Debug.getMemoryInfo(info); |
| 2046 | log.d("nativeHeapAlloc=" + Debug.getNativeHeapAllocatedSize() + ", nativeHeapSize=" + Debug.getNativeHeapSize() + ", info: " + dumpFields(infoFields, info)); |