Mercurial > hg > xemacs-beta
diff src/alloc.c @ 4803:5d120deb60ca
Enable rudimentary support for valgrind, including functions that tell valgrind
to do a leak check at runtime. See xemacs-patches message with ID
<870180fe1001060942k2b06ef1bn2631c5f226b5e6b2@mail.gmail.com>.
author | Jerry James <james@xemacs.org> |
---|---|
date | Wed, 06 Jan 2010 10:44:06 -0700 |
parents | 73e8632018ad |
children | ae81a2c00f4f |
line wrap: on
line diff
--- a/src/alloc.c Wed Jan 06 10:01:14 2010 -0700 +++ b/src/alloc.c Wed Jan 06 10:44:06 2010 -0700 @@ -71,6 +71,9 @@ #ifdef DOUG_LEA_MALLOC #include <malloc.h> #endif +#ifdef USE_VALGRIND +#include <valgrind/memcheck.h> +#endif EXFUN (Fgarbage_collect, 0); @@ -4699,6 +4702,29 @@ } #endif /* ALLOC_TYPE_STATS */ +#ifdef USE_VALGRIND +DEFUN ("valgrind-leak-check", Fvalgrind_leak_check, 0, 0, "", /* +Ask valgrind to perform a memory leak check. +The results of the leak check are sent to stderr. +*/ + ()) +{ + VALGRIND_DO_LEAK_CHECK; + return Qnil; +} + +DEFUN ("valgrind-quick-leak-check", Fvalgrind_quick_leak_check, 0, 0, "", /* +Ask valgrind to perform a quick memory leak check. +This just prints a summary of leaked memory, rather than all the details. +The results of the leak check are sent to stderr. +*/ + ()) +{ + VALGRIND_DO_QUICK_LEAK_CHECK; + return Qnil; +} +#endif /* USE_VALGRIND */ + void recompute_funcall_allocation_flag (void) { @@ -5053,6 +5079,10 @@ #endif DEFSUBR (Ftotal_memory_usage); DEFSUBR (Fconsing_since_gc); +#ifdef USE_VALGRIND + DEFSUBR (Fvalgrind_leak_check); + DEFSUBR (Fvalgrind_quick_leak_check); +#endif } void