Skip to content
Snippets Groups Projects
Commit 5b4e2498 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Add CSRIMALLOC support

parent 1429fc36
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment