Permalink
Browse files

Use mcheck.h for memory profiling

  • Loading branch information...
Sound and Fury
Sound and Fury committed Sep 10, 2010
1 parent 594acbf commit 68d1b71d2dd9a57dda88deb51634fa59f14525c0
Showing with 14 additions and 0 deletions.
  1. +5 −0 Makefile
  2. +6 −0 quirc.c
  3. +3 −0 quirc.h
View
@@ -19,6 +19,11 @@ uninstall:
quirc: quirc.c $(LIBS) $(INCLUDE)
$(CC) $(CFLAGS) -o quirc quirc.c $(LIBS)
+mtrace: quirc-mtrace
+
+quirc-mtrace: quirc.c $(LIBS) $(INCLUDE)
+ $(CC) $(CFLAGS) -o quirc-mtrace quirc.c $(LIBS) -DUSE_MTRACE
+
clean:
rm *.o quirc
View
@@ -20,6 +20,9 @@
int main(int argc, char *argv[])
{
+ #ifdef USE_MTRACE
+ mtrace();
+ #endif // USE_MTRACE
if(c_init())
{
fprintf(stderr, "Failed to initialise colours\n"); // should be impossible
@@ -313,5 +316,8 @@ int main(int argc, char *argv[])
}
}
ttyreset(STDOUT_FILENO);
+ #ifdef USE_MTRACE
+ muntrace();
+ #endif // USE_MTRACE
return(state>0?state:0);
}
View
@@ -14,6 +14,9 @@
#include <sys/time.h>
#include <ctype.h>
#include <errno.h>
+#ifdef USE_MTRACE
+ #include <mcheck.h>
+#endif // USE_MTRACE
#include "ttyraw.h"
#include "ttyesc.h"

0 comments on commit 68d1b71

Please sign in to comment.