Program: 43329
Project: 43329
Buggy source:
@Override protected void dump(FileDescriptor fd,PrintWriter pw,String[] args){
  long nativeMax=Debug.getNativeHeapSize() / 1024;
  long nativeAllocated=Debug.getNativeHeapAllocatedSize() / 1024;
  long nativeFree=Debug.getNativeHeapFreeSize() / 1024;
  Debug.MemoryInfo memInfo=new Debug.MemoryInfo();
  Debug.getMemoryInfo(memInfo);
  final int nativeShared=memInfo.nativeSharedDirty;
  final int dalvikShared=memInfo.dalvikSharedDirty;
  final int otherShared=memInfo.otherSharedDirty;
  final int nativePrivate=memInfo.nativePrivateDirty;
  final int dalvikPrivate=memInfo.dalvikPrivateDirty;
  final int otherPrivate=memInfo.otherPrivateDirty;
  Runtime runtime=Runtime.getRuntime();
  long dalvikMax=runtime.totalMemory() / 1024;
  long dalvikFree=runtime.freeMemory() / 1024;
  long dalvikAllocated=dalvikMax - dalvikFree;
  long viewInstanceCount=ViewDebug.getViewInstanceCount();
  long viewRootInstanceCount=ViewDebug.getViewRootInstanceCount();
  long appContextInstanceCount=ApplicationContext.getInstanceCount();
  long activityInstanceCount=Activity.getInstanceCount();
  int globalAssetCount=AssetManager.getGlobalAssetCount();
  int globalAssetManagerCount=AssetManager.getGlobalAssetManagerCount();
  int binderLocalObjectCount=Debug.getBinderLocalObjectCount();
  int binderProxyObjectCount=Debug.getBinderProxyObjectCount();
  int binderDeathObjectCount=Debug.getBinderDeathObjectCount();
  int openSslSocketCount=OpenSSLSocketImpl.getInstanceCount();
  long sqliteAllocated=SQLiteDebug.getHeapAllocatedSize() / 1024;
  SQLiteDebug.PagerStats stats=new SQLiteDebug.PagerStats();
  SQLiteDebug.getPagerStats(stats);
  boolean doCheckinFormat=false;
  if (args != null) {
    for (    String arg : args) {
      if ("String_Node_Str".equals(arg))       doCheckinFormat=true;
    }
  }
  if (doCheckinFormat) {
    String processName=(mBoundApplication != null) ? mBoundApplication.processName : "String_Node_Str";
    pw.print(ACTIVITY_THREAD_CHECKIN_VERSION);
    pw.print(',');
    pw.print(Process.myPid());
    pw.print(',');
    pw.print(processName);
    pw.print(',');
    pw.print(nativeMax);
    pw.print(',');
    pw.print(dalvikMax);
    pw.print(',');
    pw.print("String_Node_Str");
    pw.print(nativeMax + dalvikMax);
    pw.print(',');
    pw.print(nativeAllocated);
    pw.print(',');
    pw.print(dalvikAllocated);
    pw.print(',');
    pw.print("String_Node_Str");
    pw.print(nativeAllocated + dalvikAllocated);
    pw.print(',');
    pw.print(nativeFree);
    pw.print(',');
    pw.print(dalvikFree);
    pw.print(',');
    pw.print("String_Node_Str");
    pw.print(nativeFree + dalvikFree);
    pw.print(',');
    pw.print(memInfo.nativePss);
    pw.print(',');
    pw.print(memInfo.dalvikPss);
    pw.print(',');
    pw.print(memInfo.otherPss);
    pw.print(',');
    pw.print(memInfo.nativePss + memInfo.dalvikPss + memInfo.otherPss);
    pw.print(',');
    pw.print(nativeShared);
    pw.print(',');
    pw.print(dalvikShared);
    pw.print(',');
    pw.print(otherShared);
    pw.print(',');
    pw.print(nativeShared + dalvikShared + otherShared);
    pw.print(',');
    pw.print(nativePrivate);
    pw.print(',');
    pw.print(dalvikPrivate);
    pw.print(',');
    pw.print(otherPrivate);
    pw.print(',');
    pw.print(nativePrivate + dalvikPrivate + otherPrivate);
    pw.print(',');
    pw.print(viewInstanceCount);
    pw.print(',');
    pw.print(viewRootInstanceCount);
    pw.print(',');
    pw.print(appContextInstanceCount);
    pw.print(',');
    pw.print(activityInstanceCount);
    pw.print(',');
    pw.print(globalAssetCount);
    pw.print(',');
    pw.print(globalAssetManagerCount);
    pw.print(',');
    pw.print(binderLocalObjectCount);
    pw.print(',');
    pw.print(binderProxyObjectCount);
    pw.print(',');
    pw.print(binderDeathObjectCount);
    pw.print(',');
    pw.print(openSslSocketCount);
    pw.print(',');
    pw.print(sqliteAllocated);
    pw.print(',');
    pw.print(stats.databaseBytes / 1024);
    pw.print(',');
    pw.print(stats.numPagers);
    pw.print(',');
    pw.print((stats.totalBytes - stats.referencedBytes) / 1024);
    pw.print(',');
    pw.print(stats.referencedBytes / 1024);
    pw.print('\n');
    return;
  }
  printRow(pw,HEAP_COLUMN,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  printRow(pw,HEAP_COLUMN,"String_Node_Str",nativeMax,dalvikMax,"String_Node_Str",nativeMax + dalvikMax);
  printRow(pw,HEAP_COLUMN,"String_Node_Str",nativeAllocated,dalvikAllocated,"String_Node_Str",nativeAllocated + dalvikAllocated);
  printRow(pw,HEAP_COLUMN,"String_Node_Str",nativeFree,dalvikFree,"String_Node_Str",nativeFree + dalvikFree);
  printRow(pw,HEAP_COLUMN,"String_Node_Str",memInfo.nativePss,memInfo.dalvikPss,memInfo.otherPss,memInfo.nativePss + memInfo.dalvikPss + memInfo.otherPss);
  printRow(pw,HEAP_COLUMN,"String_Node_Str",nativeShared,dalvikShared,otherShared,nativeShared + dalvikShared + otherShared);
  printRow(pw,HEAP_COLUMN,"String_Node_Str",nativePrivate,dalvikPrivate,otherPrivate,nativePrivate + dalvikPrivate + otherPrivate);
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",viewInstanceCount,"String_Node_Str",viewRootInstanceCount);
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",appContextInstanceCount,"String_Node_Str",activityInstanceCount);
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",globalAssetCount,"String_Node_Str",globalAssetManagerCount);
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",binderLocalObjectCount,"String_Node_Str",binderProxyObjectCount);
  printRow(pw,ONE_COUNT_COLUMN,"String_Node_Str",binderDeathObjectCount);
  printRow(pw,ONE_COUNT_COLUMN,"String_Node_Str",openSslSocketCount);
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",sqliteAllocated,"String_Node_Str",stats.databaseBytes / 1024);
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",stats.numPagers,"String_Node_Str",(stats.totalBytes - stats.referencedBytes) / 1024);
  printRow(pw,ONE_COUNT_COLUMN,"String_Node_Str",stats.referencedBytes / 1024);
}

Fixed version (ground truth):
@Override protected void dump(FileDescriptor fd,PrintWriter pw,String[] args){
  long nativeMax=Debug.getNativeHeapSize() / 1024;
  long nativeAllocated=Debug.getNativeHeapAllocatedSize() / 1024;
  long nativeFree=Debug.getNativeHeapFreeSize() / 1024;
  Debug.MemoryInfo memInfo=new Debug.MemoryInfo();
  Debug.getMemoryInfo(memInfo);
  final int nativeShared=memInfo.nativeSharedDirty;
  final int dalvikShared=memInfo.dalvikSharedDirty;
  final int otherShared=memInfo.otherSharedDirty;
  final int nativePrivate=memInfo.nativePrivateDirty;
  final int dalvikPrivate=memInfo.dalvikPrivateDirty;
  final int otherPrivate=memInfo.otherPrivateDirty;
  Runtime runtime=Runtime.getRuntime();
  long dalvikMax=runtime.totalMemory() / 1024;
  long dalvikFree=runtime.freeMemory() / 1024;
  long dalvikAllocated=dalvikMax - dalvikFree;
  long viewInstanceCount=ViewDebug.getViewInstanceCount();
  long viewRootInstanceCount=ViewDebug.getViewRootInstanceCount();
  long appContextInstanceCount=ApplicationContext.getInstanceCount();
  long activityInstanceCount=Activity.getInstanceCount();
  int globalAssetCount=AssetManager.getGlobalAssetCount();
  int globalAssetManagerCount=AssetManager.getGlobalAssetManagerCount();
  int binderLocalObjectCount=Debug.getBinderLocalObjectCount();
  int binderProxyObjectCount=Debug.getBinderProxyObjectCount();
  int binderDeathObjectCount=Debug.getBinderDeathObjectCount();
  int openSslSocketCount=OpenSSLSocketImpl.getInstanceCount();
  long sqliteAllocated=SQLiteDebug.getHeapAllocatedSize() / 1024;
  SQLiteDebug.PagerStats stats=new SQLiteDebug.PagerStats();
  SQLiteDebug.getPagerStats(stats);
  boolean doCheckinFormat=false;
  if (args != null) {
    for (    String arg : args) {
      if ("String_Node_Str".equals(arg))       doCheckinFormat=true;
    }
  }
  if (doCheckinFormat) {
    String processName=(mBoundApplication != null) ? mBoundApplication.processName : "String_Node_Str";
    pw.print(ACTIVITY_THREAD_CHECKIN_VERSION);
    pw.print(',');
    pw.print(Process.myPid());
    pw.print(',');
    pw.print(processName);
    pw.print(',');
    pw.print(nativeMax);
    pw.print(',');
    pw.print(dalvikMax);
    pw.print(',');
    pw.print("String_Node_Str");
    pw.print(nativeMax + dalvikMax);
    pw.print(',');
    pw.print(nativeAllocated);
    pw.print(',');
    pw.print(dalvikAllocated);
    pw.print(',');
    pw.print("String_Node_Str");
    pw.print(nativeAllocated + dalvikAllocated);
    pw.print(',');
    pw.print(nativeFree);
    pw.print(',');
    pw.print(dalvikFree);
    pw.print(',');
    pw.print("String_Node_Str");
    pw.print(nativeFree + dalvikFree);
    pw.print(',');
    pw.print(memInfo.nativePss);
    pw.print(',');
    pw.print(memInfo.dalvikPss);
    pw.print(',');
    pw.print(memInfo.otherPss);
    pw.print(',');
    pw.print(memInfo.nativePss + memInfo.dalvikPss + memInfo.otherPss);
    pw.print(',');
    pw.print(nativeShared);
    pw.print(',');
    pw.print(dalvikShared);
    pw.print(',');
    pw.print(otherShared);
    pw.print(',');
    pw.print(nativeShared + dalvikShared + otherShared);
    pw.print(',');
    pw.print(nativePrivate);
    pw.print(',');
    pw.print(dalvikPrivate);
    pw.print(',');
    pw.print(otherPrivate);
    pw.print(',');
    pw.print(nativePrivate + dalvikPrivate + otherPrivate);
    pw.print(',');
    pw.print(viewInstanceCount);
    pw.print(',');
    pw.print(viewRootInstanceCount);
    pw.print(',');
    pw.print(appContextInstanceCount);
    pw.print(',');
    pw.print(activityInstanceCount);
    pw.print(',');
    pw.print(globalAssetCount);
    pw.print(',');
    pw.print(globalAssetManagerCount);
    pw.print(',');
    pw.print(binderLocalObjectCount);
    pw.print(',');
    pw.print(binderProxyObjectCount);
    pw.print(',');
    pw.print(binderDeathObjectCount);
    pw.print(',');
    pw.print(openSslSocketCount);
    pw.print(',');
    pw.print(sqliteAllocated);
    pw.print(',');
    pw.print(stats.databaseBytes / 1024);
    pw.print(',');
    pw.print(stats.numPagers);
    pw.print(',');
    pw.print((stats.totalBytes - stats.referencedBytes) / 1024);
    pw.print(',');
    pw.print(stats.referencedBytes / 1024);
    pw.print('\n');
    return;
  }
  printRow(pw,HEAP_COLUMN,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  printRow(pw,HEAP_COLUMN,"String_Node_Str",nativeMax,dalvikMax,"String_Node_Str",nativeMax + dalvikMax);
  printRow(pw,HEAP_COLUMN,"String_Node_Str",nativeAllocated,dalvikAllocated,"String_Node_Str",nativeAllocated + dalvikAllocated);
  printRow(pw,HEAP_COLUMN,"String_Node_Str",nativeFree,dalvikFree,"String_Node_Str",nativeFree + dalvikFree);
  printRow(pw,HEAP_COLUMN,"String_Node_Str",memInfo.nativePss,memInfo.dalvikPss,memInfo.otherPss,memInfo.nativePss + memInfo.dalvikPss + memInfo.otherPss);
  printRow(pw,HEAP_COLUMN,"String_Node_Str",nativeShared,dalvikShared,otherShared,nativeShared + dalvikShared + otherShared);
  printRow(pw,HEAP_COLUMN,"String_Node_Str",nativePrivate,dalvikPrivate,otherPrivate,nativePrivate + dalvikPrivate + otherPrivate);
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",viewInstanceCount,"String_Node_Str",viewRootInstanceCount);
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",appContextInstanceCount,"String_Node_Str",activityInstanceCount);
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",globalAssetCount,"String_Node_Str",globalAssetManagerCount);
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",binderLocalObjectCount,"String_Node_Str",binderProxyObjectCount);
  printRow(pw,ONE_COUNT_COLUMN,"String_Node_Str",binderDeathObjectCount);
  printRow(pw,ONE_COUNT_COLUMN,"String_Node_Str",openSslSocketCount);
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",sqliteAllocated,"String_Node_Str",stats.databaseBytes / 1024);
  printRow(pw,TWO_COUNT_COLUMNS,"String_Node_Str",stats.numPagers,"String_Node_Str",(stats.totalBytes - stats.referencedBytes) / 1024);
  printRow(pw,ONE_COUNT_COLUMN,"String_Node_Str",stats.referencedBytes / 1024);
  String assetAlloc=AssetManager.getAssetAllocations();
  if (assetAlloc != null) {
    pw.println("String_Node_Str");
    pw.println("String_Node_Str");
    pw.print(assetAlloc);
  }
}