From 890cc0828e4b5d3f13439c78e9ea44d8a70aa3d1 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 2 Nov 1998 23:45:36 +0000 Subject: memory leak in SAM group code: need these to track it down. (This used to be commit 4e6b548b04b2ff982baf49ebd08e22180cd521b1) --- source3/mem_man/mem_man.h | 92 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 source3/mem_man/mem_man.h (limited to 'source3/mem_man/mem_man.h') diff --git a/source3/mem_man/mem_man.h b/source3/mem_man/mem_man.h new file mode 100644 index 0000000000..60e31e6d44 --- /dev/null +++ b/source3/mem_man/mem_man.h @@ -0,0 +1,92 @@ +#if (defined(NOMEMMAN) && !defined(MEM_MAN_MAIN)) +#include +#else + +/* user settable parameters */ + +#define MEM_MANAGER + +/* +this is the maximum number of blocks that can be allocated at one +time. Set this to more than the max number of mallocs you want possible +*/ +#define MEM_MAX_MEM_OBJECTS 20000 + +/* +maximum length of a file name. This is for the source files only. This +would normally be around 30 - increase it only if necessary +*/ +#define MEM_FILE_STR_LENGTH 30 + +/* +default mem multiplier. All memory requests will be multiplied by +this number, thus allowing fast resizing. High values chew lots of +memory but allow for easy resizing +*/ +#define MEM_DEFAULT_MEM_MULTIPLIER 1 + +/* +the length of the corruption buffers before and after each memory block. +Using these can reduce memory overrun errors and catch bad code. The +amount actually allocated is this times 2 times sizeof(char) +*/ +#define MEM_CORRUPT_BUFFER 16 + +/* +the 'seed' to use for the corruption buffer. zero is a very bad choice +*/ +#define MEM_CORRUPT_SEED 0x10 + + +/* +seed increment. This is another precaution. This will be added to the +'seed' for each adjacent element of the corruption buffer +*/ +#define MEM_SEED_INCREMENT 0x1 + + +/* +memory fill. This will be copied over all allocated memory - to aid in +debugging memory dumps. It is one byte long +*/ +#define MEM_FILL_BYTE 42 + + +/* +this determines whether free() on your system returns an integer or +nothing. If unsure then leave this un defined. +*/ +/* #define MEM_FREE_RETURNS_INT */ + + +/* + This determines whether a signal handler will be instelled to do + a mem_write_verbose on request +*/ +#define MEM_SIGNAL_HANDLER + + +/* +This sets which vector to use if MEM_SIGNAL_HANDLER is defined +*/ +#define MEM_SIGNAL_VECTOR SIGUSR1 + +#ifndef MEM_MAN_MAIN +#ifdef malloc +# undef malloc +#endif +#define malloc(x) smb_mem_malloc(x,__FILE__,__LINE__) +#define free(x) smb_mem_free(x,__FILE__,__LINE__) +#define realloc(ptr,newsize) smb_mem_resize(ptr,newsize) +#ifdef calloc +# undef calloc +#endif +#define calloc(nitems,size) malloc(((_mem_size)nitems)*((_mem_size)size)) + +#ifdef strdup +# undef strdup +#endif +#define strdup(s) smb_mem_strdup(s, __FILE__, __LINE__) +#endif + +#endif -- cgit