Remove unused heap dumping code.
Change-Id: Id8774848a870003c60be2ebcc505ce30795a4fcf
diff --git a/vm/alloc/HeapDebug.c b/vm/alloc/HeapDebug.c
index 9227db5..986f16b 100644
--- a/vm/alloc/HeapDebug.c
+++ b/vm/alloc/HeapDebug.c
@@ -323,76 +323,3 @@
(void) android_btWriteLog(EVENT_LOG_TAG_dvm_gc_madvise_info,
EVENT_TYPE_LIST, eventBuf, sizeof(eventBuf));
}
-
-#if 0
-#include <errno.h>
-#include <stdio.h>
-
-typedef struct HeapDumpContext {
- FILE *fp;
- void *chunkStart;
- size_t chunkLen;
- bool chunkFree;
-} HeapDumpContext;
-
-static void
-dump_context(const HeapDumpContext *ctx)
-{
- fprintf(ctx->fp, "0x%08x %12.12zd %s\n", (uintptr_t)ctx->chunkStart,
- ctx->chunkLen, ctx->chunkFree ? "FREE" : "USED");
-}
-
-static void
-heap_chunk_callback(const void *chunkptr, size_t chunklen,
- const void *userptr, size_t userlen, void *arg)
-{
- HeapDumpContext *ctx = (HeapDumpContext *)arg;
- bool chunkFree = (userptr == NULL);
-
- if (chunkFree != ctx->chunkFree ||
- ((char *)ctx->chunkStart + ctx->chunkLen) != chunkptr)
- {
- /* The new chunk is of a different type or isn't
- * contiguous with the current chunk. Dump the
- * old one and start a new one.
- */
- if (ctx->chunkStart != NULL) {
- /* It's not the first chunk. */
- dump_context(ctx);
- }
- ctx->chunkStart = (void *)chunkptr;
- ctx->chunkLen = chunklen;
- ctx->chunkFree = chunkFree;
- } else {
- /* Extend the current chunk.
- */
- ctx->chunkLen += chunklen;
- }
-}
-
-/* Dumps free and used ranges, as text, to the named file.
- */
-void dvmDumpHeapToFile(const char *fileName)
-{
- HeapDumpContext ctx;
- FILE *fp;
-
- fp = fopen(fileName, "w+");
- if (fp == NULL) {
- LOGE("Can't open %s for writing: %s\n", fileName, strerror(errno));
- return;
- }
- LOGW("Dumping heap to %s...\n", fileName);
-
- fprintf(fp, "==== Dalvik heap dump ====\n");
- memset(&ctx, 0, sizeof(ctx));
- ctx.fp = fp;
- dvmHeapSourceWalk(heap_chunk_callback, (void *)&ctx);
- dump_context(&ctx);
- fprintf(fp, "==== end heap dump ====\n");
-
- LOGW("Dumped heap to %s.\n", fileName);
-
- fclose(fp);
-}
-#endif