mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
memory allocation failure would cause INSIST(ctx->stats[i].gets == 0) failure.
use consistant arguement name for MEMRECORD
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.97 2001/07/12 05:58:20 mayer Exp $ */
|
/* $Id: mem.c,v 1.98 2001/07/17 10:02:46 marka Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -182,11 +182,12 @@ struct isc_mempool {
|
|||||||
#define ADD_TRACE(a, b, c, d, e)
|
#define ADD_TRACE(a, b, c, d, e)
|
||||||
#define DELETE_TRACE(a, b, c, d, e)
|
#define DELETE_TRACE(a, b, c, d, e)
|
||||||
#else
|
#else
|
||||||
#define ADD_TRACE(a, b, c, d, e) add_trace_entry(a, b, c, d, e)
|
#define ADD_TRACE(a, b, c, d, e) \
|
||||||
|
do { if (b != NULL) add_trace_entry(a, b, c, d, e); } while (0)
|
||||||
#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 ((ctx->debugging & ISC_MEM_DEBUGRECORD) != 0)
|
#define MEM_RECORD ((mctx->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);
|
||||||
@@ -983,6 +984,7 @@ isc__mem_get(isc_mem_t *ctx, size_t size FLARG) {
|
|||||||
#else /* ISC_MEM_USE_INTERNAL_MALLOC */
|
#else /* ISC_MEM_USE_INTERNAL_MALLOC */
|
||||||
ptr = mem_get(ctx, size);
|
ptr = mem_get(ctx, size);
|
||||||
LOCK(&ctx->lock);
|
LOCK(&ctx->lock);
|
||||||
|
if (ptr)
|
||||||
mem_getstats(ctx, size);
|
mem_getstats(ctx, size);
|
||||||
#endif /* ISC_MEM_USE_INTERNAL_MALLOC */
|
#endif /* ISC_MEM_USE_INTERNAL_MALLOC */
|
||||||
|
|
||||||
@@ -1047,7 +1049,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 *mctx, FILE *out) {
|
||||||
if (MEM_RECORD) {
|
if (MEM_RECORD) {
|
||||||
debuglink_t *dl;
|
debuglink_t *dl;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@@ -1056,7 +1058,7 @@ print_active(isc_mem_t *ctx, FILE *out) {
|
|||||||
ISC_MSG_DUMPALLOC,
|
ISC_MSG_DUMPALLOC,
|
||||||
"Dump of all outstanding "
|
"Dump of all outstanding "
|
||||||
"memory allocations:\n"));
|
"memory allocations:\n"));
|
||||||
dl = ISC_LIST_HEAD(ctx->debuglist);
|
dl = ISC_LIST_HEAD(mctx->debuglist);
|
||||||
if (dl == NULL)
|
if (dl == NULL)
|
||||||
fprintf(out, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
fprintf(out, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||||
ISC_MSG_NONE,
|
ISC_MSG_NONE,
|
||||||
@@ -1187,6 +1189,7 @@ isc__mem_allocate(isc_mem_t *ctx, size_t size FLARG) {
|
|||||||
#else /* ISC_MEM_USE_INTERNAL_MALLOC */
|
#else /* ISC_MEM_USE_INTERNAL_MALLOC */
|
||||||
si = isc__mem_allocateunlocked(ctx, size);
|
si = isc__mem_allocateunlocked(ctx, size);
|
||||||
LOCK(&ctx->lock);
|
LOCK(&ctx->lock);
|
||||||
|
if (si != NULL)
|
||||||
mem_getstats(ctx, si[-1].u.size);
|
mem_getstats(ctx, si[-1].u.size);
|
||||||
#endif /* ISC_MEM_USE_INTERNAL_MALLOC */
|
#endif /* ISC_MEM_USE_INTERNAL_MALLOC */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user