- group database API. oops and oh dear, the threat has been carried out:
[jra/samba/.git] / source3 / mem_man / mem_man.h
1 #if  (defined(NOMEMMAN) && !defined(MEM_MAN_MAIN) && defined(HAVE_MALLOC_H))
2 #include <malloc.h>
3 #else
4
5 /* user settable parameters */
6
7 #define MEM_MANAGER
8
9 /* 
10 this is the maximum number of blocks that can be allocated at one
11 time. Set this to more than the max number of mallocs you want possible
12 */
13 #define MEM_MAX_MEM_OBJECTS 20000
14
15 /* 
16 maximum length of a file name. This is for the source files only. This
17 would normally be around 30 - increase it only if necessary
18 */
19 #define MEM_FILE_STR_LENGTH 30
20
21 /* 
22 default mem multiplier. All memory requests will be multiplied by
23 this number, thus allowing fast resizing. High values chew lots of
24 memory but allow for easy resizing 
25 */
26 #define MEM_DEFAULT_MEM_MULTIPLIER 1
27
28 /*
29 the length of the corruption buffers before and after each memory block.
30 Using these can reduce memory overrun errors and catch bad code. The
31 amount actually allocated is this times 2 times sizeof(char)
32 */
33 #define MEM_CORRUPT_BUFFER      16
34
35 /*
36 the 'seed' to use for the corruption buffer. zero is a very bad choice
37 */
38 #define MEM_CORRUPT_SEED        0x10
39
40
41 /* 
42 seed increment. This is another precaution. This will be added to the
43 'seed' for each adjacent element of the corruption buffer 
44 */
45 #define MEM_SEED_INCREMENT      0x1
46
47
48 /*
49 memory fill. This will be copied over all allocated memory - to aid in
50 debugging memory dumps. It is one byte long
51 */
52 #define MEM_FILL_BYTE   42
53
54
55 /*
56 this determines whether free() on your system returns an integer or
57 nothing. If unsure then leave this un defined.
58 */
59 /* #define MEM_FREE_RETURNS_INT */
60
61
62 /*
63   This determines whether a signal handler will be instelled to do
64   a mem_write_verbose on request
65 */
66 #define MEM_SIGNAL_HANDLER
67
68
69 /*
70 This sets which vector to use if MEM_SIGNAL_HANDLER is defined
71 */
72 #define MEM_SIGNAL_VECTOR SIGUSR1
73
74 #ifndef MEM_MAN_MAIN
75 #ifdef malloc
76 #  undef malloc
77 #endif
78 #define malloc(x) smb_mem_malloc(x,__FILE__,__LINE__)
79 #define free(x)   smb_mem_free(x,__FILE__,__LINE__)
80 #define realloc(ptr,newsize) smb_mem_resize(ptr,newsize)
81 #ifdef calloc
82 #  undef calloc
83 #endif
84 #define calloc(nitems,size) malloc(((_mem_size)nitems)*((_mem_size)size))
85
86 #ifdef strdup
87 #  undef strdup
88 #endif
89 #define strdup(s) smb_mem_strdup(s, __FILE__, __LINE__)
90 #endif
91
92 #endif