mem.c revision 80d19f35232dfcb37a38d80fd7c0a9f755c91320
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * Copyright (C) 1997, 1998, 1999, 2000 Internet Software Consortium.
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * Permission to use, copy, modify, and distribute this software for any
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * purpose with or without fee is hereby granted, provided that the above
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * copyright notice and this permission notice appear in all copies.
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * We want this on during development to catch:
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * 1. some reference after free bugs.
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * 2. some failure to initalise bugs.
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * During development it is nice to be able to see names associated with
bf49a52178db60df60f2316a3977b2249f7c0edbBrian Wellington * memory pools.
struct element {
} size_info;
struct stats {
unsigned long gets;
unsigned long totalgets;
unsigned long blocks;
unsigned long freefrags;
struct isc_mem {
unsigned int magic;
void * arg;
unsigned char ** basic_table;
unsigned int basic_table_count;
unsigned int basic_table_size;
unsigned char * lowest;
unsigned char * highest;
struct isc_mempool {
static inline size_t
int temp;
(void)arg;
(void)arg;
return (ISC_R_NOMEMORY);
if (init_max_size == 0)
if (target_size == 0)
return (ISC_R_NOMEMORY);
return (ISC_R_NOMEMORY);
return (ISC_R_UNEXPECTED);
return (ISC_R_SUCCESS);
ctxp));
return (res);
return (result);
void *new;
unsigned char **table;
unsigned int table_size;
table_size * sizeof (unsigned char *));
void *ret;
return (ret);
void *ret;
goto done;
goto done;
int i, frags;
void *new;
goto done;
done:
#if ISC_MEM_FILL
return (ret);
#if ISC_MEM_FILL
#if ISC_MEM_FILL
void *ptr;
return (ptr);
int line)
size_t i;
const struct stats *s;
if (s->blocks != 0)
return (result);
return (NULL);
char *ns;
return (NULL);
return (ns);
return (oldval);
return (quota);
#ifdef ISC_MEMCLUSTER_LEGACY
mem_default_context(void) {
return (NULL);
return (default_context);
return (NULL);
void *ptr;
return (ptr);
unsigned int count;
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
(void)mpctx;
(void)name;
goto out;
goto out;
goto out;
out:
return (item);
void *ptr;
return (ptr);
unsigned int freemax;
return (freemax);
unsigned int freecount;
return (freecount);
unsigned int maxalloc;
return (maxalloc);
unsigned int allocated;
return (allocated);
unsigned int fillcount;
return (fillcount);