00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 isc_result_t omapi_buffer_new (omapi_buffer_t **, const char *, int);
00030 isc_result_t omapi_buffer_reference (omapi_buffer_t **,
00031 omapi_buffer_t *, const char *, int);
00032 isc_result_t omapi_buffer_dereference (omapi_buffer_t **, const char *, int);
00033
00034 #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
00035 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
00036 #define DMDOFFSET (sizeof (struct dmalloc_preamble))
00037 #define DMLFSIZE 16
00038 #define DMUFSIZE 16
00039 #define DMDSIZE (DMDOFFSET + DMLFSIZE + DMUFSIZE)
00040
00041 struct dmalloc_preamble {
00042 struct dmalloc_preamble *prev, *next;
00043 const char *file;
00044 int line;
00045 size_t size;
00046 unsigned long generation;
00047 unsigned char low_fence [DMLFSIZE];
00048 };
00049 #else
00050 #define DMDOFFSET 0
00051 #define DMDSIZE 0
00052 #endif
00053
00054
00055 #define RC_LEASE 1
00056 #define RC_MISC 2
00057
00058 #if defined (DEBUG_RC_HISTORY)
00059 #if !defined (RC_HISTORY_MAX)
00060 # define RC_HISTORY_MAX 256
00061 #endif
00062
00063 #if !defined (RC_HISTORY_FLAGS)
00064 # define RC_HISTORY_FLAGS (RC_LEASE | RC_MISC)
00065 #endif
00066
00067 struct rc_history_entry {
00068 const char *file;
00069 int line;
00070 void *reference;
00071 void *addr;
00072 int refcnt;
00073 };
00074
00075 #define rc_register(x, l, r, y, z, d, f) do { \
00076 if (RC_HISTORY_FLAGS & ~(f)) { \
00077 rc_history [rc_history_index].file = (x); \
00078 rc_history [rc_history_index].line = (l); \
00079 rc_history [rc_history_index].reference = (r); \
00080 rc_history [rc_history_index].addr = (y); \
00081 rc_history [rc_history_index].refcnt = (z); \
00082 rc_history_next (d); \
00083 } \
00084 } while (0)
00085 #define rc_register_mdl(r, y, z, d, f) \
00086 rc_register (__FILE__, __LINE__, r, y, z, d, f)
00087 #else
00088 #define rc_register(file, line, reference, addr, refcnt, d, f)
00089 #define rc_register_mdl(reference, addr, refcnt, d, f)
00090 #endif
00091
00092 #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
00093 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
00094 extern struct dmalloc_preamble *dmalloc_list;
00095 extern unsigned long dmalloc_outstanding;
00096 extern unsigned long dmalloc_longterm;
00097 extern unsigned long dmalloc_generation;
00098 extern unsigned long dmalloc_cutoff_generation;
00099 #endif
00100
00101 #if defined (DEBUG_RC_HISTORY)
00102 extern struct rc_history_entry rc_history [RC_HISTORY_MAX];
00103 extern int rc_history_index;
00104 extern int rc_history_count;
00105 #endif