4607. [bug] The memory context's malloced and maxmalloced counters

were being updated without the appropriate lock being
                        held.  [RT #44869]
This commit is contained in:
Mark Andrews
2017-04-24 11:33:30 +10:00
parent a14562e120
commit 8c6ed0fe5f
2 changed files with 16 additions and 9 deletions

View File

@@ -1,3 +1,7 @@
4607. [bug] The memory context's malloced and maxmalloced counters
were being updated without the appropriate lock being
held. [RT #44869]
4606. [port] Stop using experimental "Experimental keys on scalar"
feature of perl as it has been removed. [RT #45012]

View File

@@ -810,11 +810,6 @@ mem_get(isc__mem_t *ctx, size_t size) {
ret[size-1] = 0xbe;
# endif
#endif
if (ret != NULL) {
ctx->malloced += size;
if (ctx->malloced > ctx->maxmalloced)
ctx->maxmalloced = ctx->malloced;
}
return (ret);
}
@@ -827,15 +822,12 @@ static inline void
mem_put(isc__mem_t *ctx, void *mem, size_t size) {
#if ISC_MEM_CHECKOVERRUN
INSIST(((unsigned char *)mem)[size] == 0xbe);
size += 1;
#endif
#if ISC_MEM_FILL
memset(mem, 0xde, size); /* Mnemonic for "dead". */
#endif
(ctx->memfree)(ctx->arg, mem);
#if ISC_MEM_CHECKOVERRUN
size += 1;
#endif
ctx->malloced -= size;
}
/*!
@@ -853,6 +845,13 @@ mem_getstats(isc__mem_t *ctx, size_t size) {
ctx->stats[size].gets++;
ctx->stats[size].totalgets++;
}
#if ISC_MEM_CHECKOVERRUN
size += 1;
#endif
ctx->malloced += size;
if (ctx->malloced > ctx->maxmalloced)
ctx->maxmalloced = ctx->malloced;
}
/*!
@@ -872,6 +871,10 @@ mem_putstats(isc__mem_t *ctx, void *ptr, size_t size) {
INSIST(ctx->stats[size].gets > 0U);
ctx->stats[size].gets--;
}
#if ISC_MEM_CHECKOVERRUN
size += 1;
#endif
ctx->malloced -= size;
}
/*