• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/samba/source/mem_man/
1#if  (defined(NOMEMMAN) && !defined(MEM_MAN_MAIN))
2#include <malloc.h>
3#else
4
5/* user settable parameters */
6
7#define MEM_MANAGER
8
9/*
10this is the maximum number of blocks that can be allocated at one
11time. Set this to more than the max number of mallocs you want possible
12*/
13#define MEM_MAX_MEM_OBJECTS 20000
14
15/*
16maximum length of a file name. This is for the source files only. This
17would normally be around 30 - increase it only if necessary
18*/
19#define MEM_FILE_STR_LENGTH 30
20
21/*
22default mem multiplier. All memory requests will be multiplied by
23this number, thus allowing fast resizing. High values chew lots of
24memory but allow for easy resizing
25*/
26#define MEM_DEFAULT_MEM_MULTIPLIER 1
27
28/*
29the length of the corruption buffers before and after each memory block.
30Using these can reduce memory overrun errors and catch bad code. The
31amount actually allocated is this times 2 times sizeof(char)
32*/
33#define MEM_CORRUPT_BUFFER      16
34
35/*
36the 'seed' to use for the corruption buffer. zero is a very bad choice
37*/
38#define MEM_CORRUPT_SEED        0x10
39
40
41/*
42seed 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/*
49memory fill. This will be copied over all allocated memory - to aid in
50debugging memory dumps. It is one byte long
51*/
52#define MEM_FILL_BYTE   42
53
54
55/*
56this determines whether free() on your system returns an integer or
57nothing. 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/*
70This 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
93