summaryrefslogtreecommitdiff
path: root/lib/isc/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/isc/mem.c')
-rw-r--r--lib/isc/mem.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/isc/mem.c b/lib/isc/mem.c
index 8bfe967295c9..69f6cab9ea7b 100644
--- a/lib/isc/mem.c
+++ b/lib/isc/mem.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1997-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: mem.c,v 1.98.2.7.2.12 2007/11/26 23:45:51 tbox Exp $ */
+/* $Id: mem.c,v 1.98.2.7.2.14 2008/04/28 23:45:37 tbox Exp $ */
#include <config.h>
@@ -604,7 +604,7 @@ mem_get(isc_mem_t *ctx, size_t size) {
ret = (ctx->memalloc)(ctx->arg, size);
if (ret == NULL)
- ctx->memalloc_failures++;
+ ctx->memalloc_failures++;
#if ISC_MEM_FILL
if (ret != NULL)
@@ -1036,7 +1036,6 @@ isc__mem_get(isc_mem_t *ctx, size_t size FLARG) {
ADD_TRACE(ctx, ptr, size, file, line);
if (ctx->hi_water != 0U && !ctx->hi_called &&
ctx->inuse > ctx->hi_water) {
- ctx->hi_called = ISC_TRUE;
call_water = ISC_TRUE;
}
if (ctx->inuse > ctx->maxinuse) {
@@ -1078,10 +1077,8 @@ isc__mem_put(isc_mem_t *ctx, void *ptr, size_t size FLARG)
* when the context was pushed over hi_water but then had
* isc_mem_setwater() called with 0 for hi_water and lo_water.
*/
- if (ctx->hi_called &&
+ if (ctx->hi_called &&
(ctx->inuse < ctx->lo_water || ctx->lo_water == 0U)) {
- ctx->hi_called = ISC_FALSE;
-
if (ctx->water != NULL)
call_water = ISC_TRUE;
}
@@ -1091,6 +1088,18 @@ isc__mem_put(isc_mem_t *ctx, void *ptr, size_t size FLARG)
(ctx->water)(ctx->water_arg, ISC_MEM_LOWATER);
}
+void
+isc_mem_waterack(isc_mem_t *ctx, int flag) {
+ REQUIRE(VALID_CONTEXT(ctx));
+
+ LOCK(&ctx->lock);
+ if (flag == ISC_MEM_LOWATER)
+ ctx->hi_called = ISC_FALSE;
+ else if (flag == ISC_MEM_HIWATER)
+ ctx->hi_called = ISC_TRUE;
+ UNLOCK(&ctx->lock);
+}
+
#if ISC_MEM_TRACKLINES
static void
print_active(isc_mem_t *mctx, FILE *out) {
@@ -1110,7 +1119,7 @@ print_active(isc_mem_t *mctx, FILE *out) {
"\tptr %p size %u file %s line %u\n");
for (i = 0; i <= mctx->max_size; i++) {
dl = ISC_LIST_HEAD(mctx->debuglist[i]);
-
+
if (dl != NULL)
found = ISC_TRUE;