From: Kurt Zeilenga Date: Thu, 19 Aug 1999 18:13:36 +0000 (+0000) Subject: Add CSRIMALLOC support X-Git-Tag: TWEB_OL_BASE~155 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5b4e2498d9bccda2be65e005942bcd3eec61486b;p=openldap Add CSRIMALLOC support --- diff --git a/servers/slapd/tools/slapcommon.c b/servers/slapd/tools/slapcommon.c index 3f5e0eef9f..19fca63604 100644 --- a/servers/slapd/tools/slapcommon.c +++ b/servers/slapd/tools/slapcommon.c @@ -28,6 +28,11 @@ int continuemode = 0; char *ldiffile = NULL; FILE *ldiffp = NULL; +#ifdef CSRIMALLOC + char *leakfilename; + FILE *leakfile; +#endif + Backend *be = NULL; static void @@ -80,6 +85,15 @@ slap_tool_init( progname = lutil_progname( name, argc, argv ); +#ifdef CSRIMALLOC + leakfilename = malloc( strlen( progname ) + sizeof(".leak") ); + sprintf( leakfilename, "%s.leak", progname ); + if( ( leakfile = fopen( leakfilename, "w" )) == NULL ) { + leakfile = stderr; + } + free( leakfilename ); +#endif + switch( tool ) { case SLAPADD: options = "b:cd:f:l:n:stv"; @@ -212,6 +226,10 @@ slap_tool_init( be = &backends[dbnum]; } +#ifdef CSRIMALLOC + mal_leaktrace(1); +#endif + slap_startup( be ); } @@ -219,4 +237,8 @@ void slap_tool_destroy( void ) { slap_shutdown( be ); slap_destroy(); + +#ifdef CSRIMALLOC + mal_dumpleaktrace( leakfile ); +#endif }