[poppler] Branch 'xpdf304merge' - goo/gmem.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Fri Jun 6 10:11:37 PDT 2014


 goo/gmem.cc |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit eb97a9d907a9aabec5514f621c2aa431da6deca7
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Fri Jun 6 19:09:34 2014 +0200

    xpdf304merge: Report maximum memory in use in gMemReport()

diff --git a/goo/gmem.cc b/goo/gmem.cc
index c1c607a..03fe04a 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");


More information about the poppler mailing list