mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
Add ISC_MEM_DEBUGGING to set default compile time flags.
Remember ISC_MEM_DEBUGRECORD state when isc_mem_create() is called as it is dangerous to change this afterwards.
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: mem.c,v 1.94 2001/06/27 23:29:27 marka Exp $ */
|
/* $Id: mem.c,v 1.95 2001/06/28 01:51:20 marka Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -34,7 +34,10 @@
|
|||||||
#include <isc/mutex.h>
|
#include <isc/mutex.h>
|
||||||
#include <isc/util.h>
|
#include <isc/util.h>
|
||||||
|
|
||||||
unsigned int isc_mem_debugging = 0;
|
#ifndef ISC_MEM_DEBUGGING
|
||||||
|
#define ISC_MEM_DEBUGGING 0
|
||||||
|
#endif
|
||||||
|
unsigned int isc_mem_debugging = ISC_MEM_DEBUGGING;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define ISC_MEM_USE_INTERNAL_MALLOC=1 to use the internal malloc()
|
* Define ISC_MEM_USE_INTERNAL_MALLOC=1 to use the internal malloc()
|
||||||
@@ -139,6 +142,7 @@ struct isc_mem {
|
|||||||
|
|
||||||
#if ISC_MEM_TRACKLINES
|
#if ISC_MEM_TRACKLINES
|
||||||
ISC_LIST(debuglink_t) debuglist;
|
ISC_LIST(debuglink_t) debuglist;
|
||||||
|
unsigned int debugging;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int memalloc_failures;
|
unsigned int memalloc_failures;
|
||||||
@@ -182,7 +186,7 @@ struct isc_mempool {
|
|||||||
#define DELETE_TRACE(a, b, c, d, e) delete_trace_entry(a, b, c, d, e)
|
#define DELETE_TRACE(a, b, c, d, e) delete_trace_entry(a, b, c, d, e)
|
||||||
|
|
||||||
#define MEM_TRACE ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0)
|
#define MEM_TRACE ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0)
|
||||||
#define MEM_RECORD ((isc_mem_debugging & ISC_MEM_DEBUGRECORD) != 0)
|
#define MEM_RECORD ((ctx->debugging & ISC_MEM_DEBUGRECORD) != 0)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_active(isc_mem_t *ctx, FILE *out);
|
print_active(isc_mem_t *ctx, FILE *out);
|
||||||
@@ -759,6 +763,7 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
|
|||||||
|
|
||||||
#if ISC_MEM_TRACKLINES
|
#if ISC_MEM_TRACKLINES
|
||||||
ISC_LIST_INIT(ctx->debuglist);
|
ISC_LIST_INIT(ctx->debuglist);
|
||||||
|
ctx->debugging = isc_mem_debugging;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ctx->memalloc_failures = 0;
|
ctx->memalloc_failures = 0;
|
||||||
@@ -1043,7 +1048,7 @@ isc__mem_put(isc_mem_t *ctx, void *ptr, size_t size FLARG)
|
|||||||
#if ISC_MEM_TRACKLINES
|
#if ISC_MEM_TRACKLINES
|
||||||
static void
|
static void
|
||||||
print_active(isc_mem_t *ctx, FILE *out) {
|
print_active(isc_mem_t *ctx, FILE *out) {
|
||||||
if (isc_mem_debugging > 1) {
|
if (ctx->debugging > 1) {
|
||||||
debuglink_t *dl;
|
debuglink_t *dl;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user