From 6f7e2ecdbc00015d008e76c1201f82c099bbf00a Mon Sep 17 00:00:00 2001 From: "e.gavrin" Date: Thu, 31 Jul 2014 17:56:17 +0400 Subject: [PATCH] add --mem-stats flag to print memory usage statistics at exit --- src/main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index aacee92e2..b1ba0ea05 100644 --- a/src/main.c +++ b/src/main.c @@ -146,6 +146,7 @@ main (int argc __unused, { const char *file_name = NULL; bool parse_only = false; + bool print_mem_stats = false; int i; for (i = 1; i < argc; i++) @@ -157,6 +158,10 @@ main (int argc __unused, __printf("Branch name:\t%s\n", JERRY_BRANCH_NAME); __printf("\n"); } + if (!__strcmp ("--mem-stats", argv[i])) + { + print_mem_stats = true; + } else if (!__strcmp ("--parse-only", argv[i])) { parse_only = true; @@ -181,8 +186,10 @@ main (int argc __unused, jerry_run (source_p, source_size, parse_only); - mem_heap_print( false, false, true); - + if (print_mem_stats) + { + mem_heap_print( false, false, true); + } return 0; } #endif