diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2014-06-06 19:09:34 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2014-06-06 19:09:34 +0200 |
commit | eb97a9d907a9aabec5514f621c2aa431da6deca7 (patch) | |
tree | d4a2e9dbeaabe5814e0dbb2dfc669ba811c6128a | |
parent | 6f78125cda11d97d8db3e3d0e9cba7029f0bc9d8 (diff) |
xpdf304merge: Report maximum memory in use in gMemReport()
-rw-r--r-- | goo/gmem.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/goo/gmem.cc b/goo/gmem.cc index c1c607ac..03fe04ae 100644 --- a/goo/gmem.cc +++ b/goo/gmem.cc @@ -60,6 +60,7 @@ static GMemHdr *gMemTail = NULL; static int gMemIndex = 0; static int gMemAlloc = 0; static int gMemInUse = 0; +static int gMaxMemInUse = 0; #endif /* DEBUG_MEM */ @@ -97,6 +98,9 @@ inline static void *gmalloc(size_t size, bool checkoverflow) { hdr->next = NULL; ++gMemAlloc; gMemInUse += size; + if (gMemInUse > gMaxMemInUse) { + gMaxMemInUse = gMemInUse; + } for (p = (unsigned long *)data; p <= trl; ++p) { *p = gMemDeadVal; } @@ -297,6 +301,7 @@ void gMemReport(FILE *f) { GMemHdr *p; fprintf(f, "%d memory allocations in all\n", gMemIndex); + fprintf(f, "maximum memory in use: %d bytes\n", gMaxMemInUse); if (gMemAlloc > 0) { fprintf(f, "%d memory blocks left allocated:\n", gMemAlloc); fprintf(f, " index size\n"); |