}
if (mctx != NULL) {
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
}
return result == ISC_R_SUCCESS ? 0 : 1;
fprintf(errout, "OK\n");
}
destroy();
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return (result == ISC_R_SUCCESS) ? 0 : 1;
}
isc_mem_stats(mctx, stderr);
}
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return 0;
}
isc_mem_stats(mctx, stderr);
}
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return 0;
}
if (print_mem_stats && verbose > 10) {
isc_mem_stats(mctx, stdout);
}
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
}
}
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
fflush(stdout);
if (ferror(stdout)) {
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
fflush(stdout);
if (ferror(stdout)) {
isc_mem_stats(mctx, stdout);
}
isc_mem_free(mctx, label);
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
if (freeit != NULL) {
free(freeit);
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
if (freeit != NULL) {
free(freeit);
if (dir != NULL) {
isc_mem_free(mctx, dir);
}
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return 0;
}
isc_mem_stats(mctx, stdout);
}
isc_mem_free(mctx, directory);
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return 0;
}
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return result == ISC_R_SUCCESS ? 0 : 1;
}
}
if (mctx != NULL) {
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
}
return result != ISC_R_SUCCESS ? 1 : 0;
printf("%s\n", filename);
dst_key_free(&key);
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return 0;
}
if (printmemstats) {
isc_mem_stats(mctx, stdout);
}
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return 0;
}
if (message != NULL) {
dns_message_detach(&message);
}
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
exit(rv);
}
isc_lex_destroy(&lex);
}
if (mctx != NULL) {
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
}
}
if (memstats) {
isc_mem_stats(mctx, stderr);
}
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
fflush(stdout);
if (ferror(stdout)) {
end:
dns_db_detach(&db);
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return 0;
}
}
dns_qp_destroy(&qp);
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
isc_mem_checkdestroyed(stderr);
for (size_t i = 0; i < ARRAY_SIZE(item); i++) {
cleanup:
isc_lex_close(lex);
isc_lex_destroy(&lex);
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return 0;
}
}
}
- isc_mem_destroy(&dst__mctx);
+ isc_mem_detach(&dst__mctx);
}
bool
OPENSSL_cleanup();
- isc_mem_destroy(&isc__crypto_mctx);
+ isc_mem_detach(&isc__crypto_mctx);
}
*/
/*@}*/
-#define isc_mem_destroy(cp) isc__mem_destroy((cp)_ISC_MEM_FILELINE)
-void
-isc__mem_destroy(isc_mem_t **_ISC_MEM_FLARG);
-/*%<
- * Destroy a memory context.
- */
-
void
isc_mem_stats(isc_mem_t *mctx, FILE *out);
/*%<
isc_netmgr_destroy(netmgrp);
isc_loopmgr_destroy(loopmgrp);
- isc_mem_destroy(mctxp);
+ isc_mem_detach(mctxp);
}
isc__mem_detach(&ctx FLARG_PASS);
}
-void
-isc__mem_destroy(isc_mem_t **ctxp FLARG) {
- isc_mem_t *ctx = NULL;
-
- /*
- * This routine provides legacy support for callers who use mctxs
- * without attaching/detaching.
- */
-
- REQUIRE(ctxp != NULL && VALID_CONTEXT(*ctxp));
-
- ctx = *ctxp;
- *ctxp = NULL;
-
- rcu_barrier();
-
-#if ISC_MEM_TRACKLINES
- if ((ctx->debugging & ISC_MEM_DEBUGTRACE) != 0) {
- fprintf(stderr, "destroy mctx %p file %s line %u\n", ctx, file,
- line);
- }
-
- if (isc_refcount_decrement(&ctx->references) > 1) {
- print_active(ctx, stderr);
- }
-#else /* if ISC_MEM_TRACKLINES */
- isc_refcount_decrementz(&ctx->references);
-#endif /* if ISC_MEM_TRACKLINES */
- isc_refcount_destroy(&ctx->references);
- destroy(ctx);
-
- *ctxp = NULL;
-}
-
void *
isc__mem_get(isc_mem_t *ctx, size_t size, int flags FLARG) {
void *ptr = NULL;
isc__uv_shutdown(void) {
#if UV_VERSION_HEX >= UV_VERSION(1, 38, 0)
uv_library_shutdown();
- isc_mem_destroy(&isc__uv_mctx);
+ isc_mem_detach(&isc__uv_mctx);
#endif /* UV_VERSION_HEX < UV_VERSION(1, 38, 0) */
}
isc__xml_shutdown(void) {
#ifdef HAVE_LIBXML2
xmlCleanupParser();
- isc_mem_destroy(&isc__xml_mctx);
+ isc_mem_detach(&isc__xml_mctx);
#endif /* HAVE_LIBXML2 */
}
printf("names %u\n", count);
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return 0;
}
isc_mem_free(mctx, item);
isc_mem_checkdestroyed(stdout);
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return 0;
}
}
dns_db_detach(&db);
- isc_mem_destroy(&mctx2);
+ isc_mem_detach(&mctx2);
isc_loopmgr_shutdown(loopmgr);
}
}
dns_db_detach(&db);
- isc_mem_destroy(&mctx2);
+ isc_mem_detach(&mctx2);
isc_loopmgr_shutdown(loopmgr);
}
r = cmocka_run_group_tests(tests, setup, teardown); \
} \
\
- isc_mem_destroy(&mctx); \
+ isc_mem_detach(&mctx); \
\
return (r); \
}
assert_int_equal(diff, 0);
- isc_mem_destroy(&mctx2);
+ isc_mem_detach(&mctx2);
}
ISC_RUN_TEST_IMPL(isc_mem_zeroget) {
isc_mem_free(omctx, data1);
assert_false(isc_mem_isovermem(omctx));
- isc_mem_destroy(&omctx);
+ isc_mem_detach(&omctx);
}
#if ISC_MEM_TRACKLINES
assert_non_null(ptr);
isc__mem_printactive(mctx2, f);
isc_mem_put(mctx2, ptr, 2048);
- isc_mem_destroy(&mctx2);
+ isc_mem_detach(&mctx2);
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
isc_stdio_close(f);
assert_non_null(ptr);
isc__mem_printactive(mctx2, f);
isc_mem_put(mctx2, ptr, 2048);
- isc_mem_destroy(&mctx2);
+ isc_mem_detach(&mctx2);
isc_stdio_close(f);
memset(buf, 0, sizeof(buf));
assert_non_null(ptr);
isc__mem_printactive(mctx2, f);
isc_mem_put(mctx2, ptr, 2048);
- isc_mem_destroy(&mctx2);
+ isc_mem_detach(&mctx2);
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
isc_stdio_close(f);
int
teardown_mctx(void **state ISC_ATTR_UNUSED) {
- isc_mem_destroy(&mctx);
+ isc_mem_detach(&mctx);
return 0;
}