mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 22:45:39 +00:00
Remove malloced and maxmalloced memory counter
The malloced and maxmalloced memory counters were mostly useless since we removed the internal allocator blocks - it would only differ from inuse by the memory context size itself.
This commit is contained in:
@@ -1042,8 +1042,6 @@
|
|||||||
<th>TotalUse</th>
|
<th>TotalUse</th>
|
||||||
<th>InUse</th>
|
<th>InUse</th>
|
||||||
<th>MaxUse</th>
|
<th>MaxUse</th>
|
||||||
<th>Malloced</th>
|
|
||||||
<th>MaxMalloced</th>
|
|
||||||
<th>BlockSize</th>
|
<th>BlockSize</th>
|
||||||
<th>Pools</th>
|
<th>Pools</th>
|
||||||
<th>HiWater</th>
|
<th>HiWater</th>
|
||||||
@@ -1076,12 +1074,6 @@
|
|||||||
<td>
|
<td>
|
||||||
<xsl:value-of select="maxinuse"/>
|
<xsl:value-of select="maxinuse"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
|
||||||
<xsl:value-of select="malloced"/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<xsl:value-of select="maxmalloced"/>
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
<xsl:value-of select="blocksize"/>
|
<xsl:value-of select="blocksize"/>
|
||||||
</td>
|
</td>
|
||||||
|
@@ -119,16 +119,14 @@ if [ $PERL_XML ]; then
|
|||||||
file=`$PERL fetch.pl -p ${EXTRAPORT1} xml/v3/mem`
|
file=`$PERL fetch.pl -p ${EXTRAPORT1} xml/v3/mem`
|
||||||
mv $file xml.mem
|
mv $file xml.mem
|
||||||
$PERL mem-xml.pl $file > xml.fmtmem
|
$PERL mem-xml.pl $file > xml.fmtmem
|
||||||
grep "'Malloced' => '[0-9][0-9]*'" xml.fmtmem > /dev/null || ret=1
|
grep "'InUse' => '[0-9][0-9]*'" xml.fmtmem > /dev/null || ret=1
|
||||||
grep "'malloced' => '[0-9][0-9]*'" xml.fmtmem > /dev/null || ret=1
|
grep "'inuse' => '[0-9][0-9]*'" xml.fmtmem > /dev/null || ret=1
|
||||||
grep "'maxmalloced' => '[0-9][0-9]*'" xml.fmtmem > /dev/null || ret=1
|
|
||||||
fi
|
fi
|
||||||
if [ $PERL_JSON ]; then
|
if [ $PERL_JSON ]; then
|
||||||
file=`$PERL fetch.pl -p ${EXTRAPORT1} json/v1/mem`
|
file=`$PERL fetch.pl -p ${EXTRAPORT1} json/v1/mem`
|
||||||
mv $file json.mem
|
mv $file json.mem
|
||||||
grep '"malloced":[0-9][0-9]*,' json.mem > /dev/null || ret=1
|
grep '"inuse":[0-9][0-9]*,' json.mem > /dev/null || ret=1
|
||||||
grep '"maxmalloced":[0-9][0-9]*,' json.mem > /dev/null || ret=1
|
grep '"InUse":[0-9][0-9]*,' json.mem > /dev/null || ret=1
|
||||||
grep '"Malloced":[0-9][0-9]*,' json.mem > /dev/null || ret=1
|
|
||||||
fi
|
fi
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=$((status + ret))
|
status=$((status + ret))
|
||||||
|
@@ -285,19 +285,6 @@ isc_mem_total(isc_mem_t *mctx);
|
|||||||
* not yet used.
|
* not yet used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
size_t
|
|
||||||
isc_mem_malloced(isc_mem_t *ctx);
|
|
||||||
/*%<
|
|
||||||
* Get an estimate of the amount of memory allocated in 'mctx', in bytes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
size_t
|
|
||||||
isc_mem_maxmalloced(isc_mem_t *ctx);
|
|
||||||
/*%<
|
|
||||||
* Get an estimate of the largest amount of memory that has been
|
|
||||||
* allocated in 'mctx' at any time.
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isc_mem_isovermem(isc_mem_t *mctx);
|
isc_mem_isovermem(isc_mem_t *mctx);
|
||||||
/*%<
|
/*%<
|
||||||
|
@@ -144,8 +144,6 @@ struct isc_mem {
|
|||||||
atomic_size_t total;
|
atomic_size_t total;
|
||||||
atomic_size_t inuse;
|
atomic_size_t inuse;
|
||||||
atomic_size_t maxinuse;
|
atomic_size_t maxinuse;
|
||||||
atomic_size_t malloced;
|
|
||||||
atomic_size_t maxmalloced;
|
|
||||||
atomic_bool hi_called;
|
atomic_bool hi_called;
|
||||||
atomic_bool is_overmem;
|
atomic_bool is_overmem;
|
||||||
isc_mem_water_t water;
|
isc_mem_water_t water;
|
||||||
@@ -211,22 +209,6 @@ static void
|
|||||||
print_active(isc_mem_t *ctx, FILE *out);
|
print_active(isc_mem_t *ctx, FILE *out);
|
||||||
#endif /* ISC_MEM_TRACKLINES */
|
#endif /* ISC_MEM_TRACKLINES */
|
||||||
|
|
||||||
static void
|
|
||||||
increment_malloced(isc_mem_t *ctx, size_t size) {
|
|
||||||
size_t malloced = atomic_fetch_add_relaxed(&ctx->malloced, size) + size;
|
|
||||||
size_t maxmalloced = atomic_load_relaxed(&ctx->maxmalloced);
|
|
||||||
|
|
||||||
if (malloced > maxmalloced) {
|
|
||||||
atomic_compare_exchange_strong(&ctx->maxmalloced, &maxmalloced,
|
|
||||||
malloced);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
decrement_malloced(isc_mem_t *ctx, size_t size) {
|
|
||||||
(void)atomic_fetch_sub_relaxed(&ctx->malloced, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ISC_MEM_TRACKLINES
|
#if ISC_MEM_TRACKLINES
|
||||||
/*!
|
/*!
|
||||||
* mctx must not be locked.
|
* mctx must not be locked.
|
||||||
@@ -261,7 +243,6 @@ add_trace_entry(isc_mem_t *mctx, const void *ptr, size_t size FLARG) {
|
|||||||
|
|
||||||
dl = mallocx(sizeof(debuglink_t), 0);
|
dl = mallocx(sizeof(debuglink_t), 0);
|
||||||
INSIST(dl != NULL);
|
INSIST(dl != NULL);
|
||||||
increment_malloced(mctx, sizeof(debuglink_t));
|
|
||||||
|
|
||||||
ISC_LINK_INIT(dl, link);
|
ISC_LINK_INIT(dl, link);
|
||||||
dl->ptr = ptr;
|
dl->ptr = ptr;
|
||||||
@@ -308,7 +289,6 @@ delete_trace_entry(isc_mem_t *mctx, const void *ptr, size_t size,
|
|||||||
while (dl != NULL) {
|
while (dl != NULL) {
|
||||||
if (dl->ptr == ptr) {
|
if (dl->ptr == ptr) {
|
||||||
ISC_LIST_UNLINK(mctx->debuglist[idx], dl, link);
|
ISC_LIST_UNLINK(mctx->debuglist[idx], dl, link);
|
||||||
decrement_malloced(mctx, sizeof(*dl));
|
|
||||||
sdallocx(dl, sizeof(*dl), 0);
|
sdallocx(dl, sizeof(*dl), 0);
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
@@ -404,8 +384,6 @@ mem_getstats(isc_mem_t *ctx, size_t size) {
|
|||||||
|
|
||||||
atomic_fetch_add_relaxed(&stats->gets, 1);
|
atomic_fetch_add_relaxed(&stats->gets, 1);
|
||||||
atomic_fetch_add_relaxed(&stats->totalgets, 1);
|
atomic_fetch_add_relaxed(&stats->totalgets, 1);
|
||||||
|
|
||||||
increment_malloced(ctx, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -423,8 +401,6 @@ mem_putstats(isc_mem_t *ctx, void *ptr, size_t size) {
|
|||||||
|
|
||||||
g = atomic_fetch_sub_release(&stats->gets, 1);
|
g = atomic_fetch_sub_release(&stats->gets, 1);
|
||||||
INSIST(g >= 1);
|
INSIST(g >= 1);
|
||||||
|
|
||||||
decrement_malloced(ctx, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -487,8 +463,6 @@ mem_create(isc_mem_t **ctxp, unsigned int debugging, unsigned int flags) {
|
|||||||
atomic_init(&ctx->total, 0);
|
atomic_init(&ctx->total, 0);
|
||||||
atomic_init(&ctx->inuse, 0);
|
atomic_init(&ctx->inuse, 0);
|
||||||
atomic_init(&ctx->maxinuse, 0);
|
atomic_init(&ctx->maxinuse, 0);
|
||||||
atomic_init(&ctx->malloced, sizeof(*ctx));
|
|
||||||
atomic_init(&ctx->maxmalloced, sizeof(*ctx));
|
|
||||||
atomic_init(&ctx->hi_water, 0);
|
atomic_init(&ctx->hi_water, 0);
|
||||||
atomic_init(&ctx->lo_water, 0);
|
atomic_init(&ctx->lo_water, 0);
|
||||||
atomic_init(&ctx->hi_called, false);
|
atomic_init(&ctx->hi_called, false);
|
||||||
@@ -511,8 +485,6 @@ mem_create(isc_mem_t **ctxp, unsigned int debugging, unsigned int flags) {
|
|||||||
for (i = 0; i < DEBUG_TABLE_COUNT; i++) {
|
for (i = 0; i < DEBUG_TABLE_COUNT; i++) {
|
||||||
ISC_LIST_INIT(ctx->debuglist[i]);
|
ISC_LIST_INIT(ctx->debuglist[i]);
|
||||||
}
|
}
|
||||||
increment_malloced(ctx,
|
|
||||||
DEBUG_TABLE_COUNT * sizeof(debuglist_t));
|
|
||||||
}
|
}
|
||||||
#endif /* if ISC_MEM_TRACKLINES */
|
#endif /* if ISC_MEM_TRACKLINES */
|
||||||
|
|
||||||
@@ -554,14 +526,11 @@ destroy(isc_mem_t *ctx) {
|
|||||||
|
|
||||||
ISC_LIST_UNLINK(ctx->debuglist[i], dl, link);
|
ISC_LIST_UNLINK(ctx->debuglist[i], dl, link);
|
||||||
sdallocx(dl, sizeof(*dl), 0);
|
sdallocx(dl, sizeof(*dl), 0);
|
||||||
decrement_malloced(ctx, sizeof(*dl));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sdallocx(ctx->debuglist,
|
sdallocx(ctx->debuglist,
|
||||||
(DEBUG_TABLE_COUNT * sizeof(debuglist_t)), 0);
|
(DEBUG_TABLE_COUNT * sizeof(debuglist_t)), 0);
|
||||||
decrement_malloced(ctx,
|
|
||||||
DEBUG_TABLE_COUNT * sizeof(debuglist_t));
|
|
||||||
}
|
}
|
||||||
#endif /* if ISC_MEM_TRACKLINES */
|
#endif /* if ISC_MEM_TRACKLINES */
|
||||||
|
|
||||||
@@ -586,7 +555,7 @@ destroy(isc_mem_t *ctx) {
|
|||||||
isc_mutex_destroy(&ctx->lock);
|
isc_mutex_destroy(&ctx->lock);
|
||||||
|
|
||||||
if (ctx->checkfree) {
|
if (ctx->checkfree) {
|
||||||
INSIST(atomic_load(&ctx->malloced) == 0);
|
INSIST(atomic_load(&ctx->inuse) == 0);
|
||||||
}
|
}
|
||||||
sdallocx(ctx, sizeof(*ctx), ISC_MEM_ALIGN(isc_os_cacheline()));
|
sdallocx(ctx, sizeof(*ctx), ISC_MEM_ALIGN(isc_os_cacheline()));
|
||||||
}
|
}
|
||||||
@@ -1073,20 +1042,6 @@ isc_mem_total(isc_mem_t *ctx) {
|
|||||||
return (atomic_load_acquire(&ctx->total));
|
return (atomic_load_acquire(&ctx->total));
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
|
||||||
isc_mem_malloced(isc_mem_t *ctx) {
|
|
||||||
REQUIRE(VALID_CONTEXT(ctx));
|
|
||||||
|
|
||||||
return (atomic_load_acquire(&ctx->malloced));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t
|
|
||||||
isc_mem_maxmalloced(isc_mem_t *ctx) {
|
|
||||||
REQUIRE(VALID_CONTEXT(ctx));
|
|
||||||
|
|
||||||
return (atomic_load_acquire(&ctx->maxmalloced));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
isc_mem_clearwater(isc_mem_t *mctx) {
|
isc_mem_clearwater(isc_mem_t *mctx) {
|
||||||
isc_mem_setwater(mctx, NULL, NULL, 0, 0);
|
isc_mem_setwater(mctx, NULL, NULL, 0, 0);
|
||||||
@@ -1459,7 +1414,6 @@ isc_mem_references(isc_mem_t *ctx) {
|
|||||||
typedef struct summarystat {
|
typedef struct summarystat {
|
||||||
uint64_t total;
|
uint64_t total;
|
||||||
uint64_t inuse;
|
uint64_t inuse;
|
||||||
uint64_t malloced;
|
|
||||||
uint64_t contextsize;
|
uint64_t contextsize;
|
||||||
} summarystat_t;
|
} summarystat_t;
|
||||||
|
|
||||||
@@ -1521,17 +1475,6 @@ xml_renderctx(isc_mem_t *ctx, summarystat_t *summary, xmlTextWriterPtr writer) {
|
|||||||
(uint64_t)isc_mem_maxinuse(ctx)));
|
(uint64_t)isc_mem_maxinuse(ctx)));
|
||||||
TRY0(xmlTextWriterEndElement(writer)); /* maxinuse */
|
TRY0(xmlTextWriterEndElement(writer)); /* maxinuse */
|
||||||
|
|
||||||
summary->malloced += isc_mem_malloced(ctx);
|
|
||||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "malloced"));
|
|
||||||
TRY0(xmlTextWriterWriteFormatString(writer, "%" PRIu64 "",
|
|
||||||
(uint64_t)isc_mem_malloced(ctx)));
|
|
||||||
TRY0(xmlTextWriterEndElement(writer)); /* malloced */
|
|
||||||
|
|
||||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "maxmalloced"));
|
|
||||||
TRY0(xmlTextWriterWriteFormatString(
|
|
||||||
writer, "%" PRIu64 "", (uint64_t)isc_mem_maxmalloced(ctx)));
|
|
||||||
TRY0(xmlTextWriterEndElement(writer)); /* maxmalloced */
|
|
||||||
|
|
||||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "pools"));
|
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "pools"));
|
||||||
TRY0(xmlTextWriterWriteFormatString(writer, "%u", ctx->poolcnt));
|
TRY0(xmlTextWriterWriteFormatString(writer, "%u", ctx->poolcnt));
|
||||||
TRY0(xmlTextWriterEndElement(writer)); /* pools */
|
TRY0(xmlTextWriterEndElement(writer)); /* pools */
|
||||||
@@ -1594,11 +1537,6 @@ isc_mem_renderxml(void *writer0) {
|
|||||||
summary.inuse));
|
summary.inuse));
|
||||||
TRY0(xmlTextWriterEndElement(writer)); /* InUse */
|
TRY0(xmlTextWriterEndElement(writer)); /* InUse */
|
||||||
|
|
||||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "Malloced"));
|
|
||||||
TRY0(xmlTextWriterWriteFormatString(writer, "%" PRIu64 "",
|
|
||||||
summary.malloced));
|
|
||||||
TRY0(xmlTextWriterEndElement(writer)); /* InUse */
|
|
||||||
|
|
||||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "ContextSize"));
|
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "ContextSize"));
|
||||||
TRY0(xmlTextWriterWriteFormatString(writer, "%" PRIu64 "",
|
TRY0(xmlTextWriterWriteFormatString(writer, "%" PRIu64 "",
|
||||||
summary.contextsize));
|
summary.contextsize));
|
||||||
@@ -1632,7 +1570,6 @@ json_renderctx(isc_mem_t *ctx, summarystat_t *summary, json_object *array) {
|
|||||||
summary->contextsize += sizeof(*ctx);
|
summary->contextsize += sizeof(*ctx);
|
||||||
summary->total += isc_mem_total(ctx);
|
summary->total += isc_mem_total(ctx);
|
||||||
summary->inuse += isc_mem_inuse(ctx);
|
summary->inuse += isc_mem_inuse(ctx);
|
||||||
summary->malloced += isc_mem_malloced(ctx);
|
|
||||||
#if ISC_MEM_TRACKLINES
|
#if ISC_MEM_TRACKLINES
|
||||||
if (ctx->debuglist != NULL) {
|
if (ctx->debuglist != NULL) {
|
||||||
summary->contextsize += DEBUG_TABLE_COUNT *
|
summary->contextsize += DEBUG_TABLE_COUNT *
|
||||||
@@ -1671,14 +1608,6 @@ json_renderctx(isc_mem_t *ctx, summarystat_t *summary, json_object *array) {
|
|||||||
CHECKMEM(obj);
|
CHECKMEM(obj);
|
||||||
json_object_object_add(ctxobj, "maxinuse", obj);
|
json_object_object_add(ctxobj, "maxinuse", obj);
|
||||||
|
|
||||||
obj = json_object_new_int64(isc_mem_malloced(ctx));
|
|
||||||
CHECKMEM(obj);
|
|
||||||
json_object_object_add(ctxobj, "malloced", obj);
|
|
||||||
|
|
||||||
obj = json_object_new_int64(isc_mem_maxmalloced(ctx));
|
|
||||||
CHECKMEM(obj);
|
|
||||||
json_object_object_add(ctxobj, "maxmalloced", obj);
|
|
||||||
|
|
||||||
obj = json_object_new_int64(ctx->poolcnt);
|
obj = json_object_new_int64(ctx->poolcnt);
|
||||||
CHECKMEM(obj);
|
CHECKMEM(obj);
|
||||||
json_object_object_add(ctxobj, "pools", obj);
|
json_object_object_add(ctxobj, "pools", obj);
|
||||||
@@ -1731,10 +1660,6 @@ isc_mem_renderjson(void *memobj0) {
|
|||||||
CHECKMEM(obj);
|
CHECKMEM(obj);
|
||||||
json_object_object_add(memobj, "InUse", obj);
|
json_object_object_add(memobj, "InUse", obj);
|
||||||
|
|
||||||
obj = json_object_new_int64(summary.malloced);
|
|
||||||
CHECKMEM(obj);
|
|
||||||
json_object_object_add(memobj, "Malloced", obj);
|
|
||||||
|
|
||||||
obj = json_object_new_int64(summary.contextsize);
|
obj = json_object_new_int64(summary.contextsize);
|
||||||
CHECKMEM(obj);
|
CHECKMEM(obj);
|
||||||
json_object_object_add(memobj, "ContextSize", obj);
|
json_object_object_add(memobj, "ContextSize", obj);
|
||||||
|
Reference in New Issue
Block a user