dbinfo *dbi;
dns_dbversion_t *version;
const dns_name_t *origin;
- size_t memory_quota = 0;
dns_trust_t trust = 0;
unsigned int addopts;
isc_log_t *lctx = NULL;
case 'P':
pause_every = atoi(isc_commandline_argument);
break;
- case 'Q':
- memory_quota = atoi(isc_commandline_argument);
- isc_mem_setquota(mctx, memory_quota);
- break;
case 't':
type = atoi(isc_commandline_argument);
break;
* destroyed and abort the program if any are present.
*/
-/*@{*/
-void
-isc_mem_setquota(isc_mem_t *, size_t);
-size_t
-isc_mem_getquota(isc_mem_t *);
-/*%<
- * Set/get the memory quota of 'mctx'. This is a hard limit
- * on the amount of memory that may be allocated from mctx;
- * if it is exceeded, allocations will fail.
- */
-/*@}*/
-
size_t
isc_mem_inuse(isc_mem_t *mctx);
/*%<
isc_refcount_t references;
char name[16];
void * tag;
- size_t quota;
size_t total;
size_t inuse;
size_t maxinuse;
unsigned char *first, *last;
unsigned char **table;
unsigned int table_size;
- size_t increment;
int i;
/* Require: we hold the context lock. */
- /*
- * Did we hit the quota for this context?
- */
- increment = NUM_BASIC_BLOCKS * ctx->mem_target;
- if (ctx->quota != 0U && ctx->total + increment > ctx->quota)
- return (false);
-
INSIST(ctx->basic_table_count <= ctx->basic_table_size);
if (ctx->basic_table_count == ctx->basic_table_size) {
table_size = ctx->basic_table_size + TABLE_INCREMENT;
ctx->memalloc_failures++;
return (false);
}
- ctx->total += increment;
+ ctx->total += NUM_BASIC_BLOCKS * ctx->mem_target;;
ctx->basic_table[ctx->basic_table_count] = tmp;
ctx->basic_table_count++;
ctx->malloced += NUM_BASIC_BLOCKS * ctx->mem_target;
/*
* memget() was called on something beyond our upper limit.
*/
- if (ctx->quota != 0U && ctx->total + size > ctx->quota) {
- ret = NULL;
- goto done;
- }
ret = (ctx->memalloc)(ctx->arg, size);
if (ret == NULL) {
ctx->memalloc_failures++;
isc_refcount_init(&ctx->references, 1);
memset(ctx->name, 0, sizeof(ctx->name));
ctx->tag = NULL;
- ctx->quota = 0;
ctx->total = 0;
ctx->inuse = 0;
ctx->maxinuse = 0;
MCTXUNLOCK(ctx, &ctx->lock);
}
-/*
- * Quotas
- */
-
-void
-isc_mem_setquota(isc_mem_t *ctx0, size_t quota) {
- isc__mem_t *ctx = (isc__mem_t *)ctx0;
-
- REQUIRE(VALID_CONTEXT(ctx));
- MCTXLOCK(ctx, &ctx->lock);
-
- ctx->quota = quota;
-
- MCTXUNLOCK(ctx, &ctx->lock);
-}
-
-size_t
-isc_mem_getquota(isc_mem_t *ctx0) {
- isc__mem_t *ctx = (isc__mem_t *)ctx0;
- size_t quota;
-
- REQUIRE(VALID_CONTEXT(ctx));
- MCTXLOCK(ctx, &ctx->lock);
-
- quota = ctx->quota;
-
- MCTXUNLOCK(ctx, &ctx->lock);
-
- return (quota);
-}
-
size_t
isc_mem_inuse(isc_mem_t *ctx0) {
isc__mem_t *ctx = (isc__mem_t *)ctx0;