mem.h File Reference

#include <stdio.h>
#include <isc/json.h>
#include <isc/lang.h>
#include <isc/mutex.h>
#include <isc/platform.h>
#include <isc/types.h>
#include <isc/xml.h>

Go to the source code of this file.

Data Structures

struct  isc_memmethods
 isc_mem_putanddetach() is a convenience function for use where you have a structure with an attached memory context. More...
struct  isc_mempoolmethods
struct  isc_mem
 This structure is actually just the common prefix of a memory context implementation's version of an isc_mem_t. More...
struct  isc_mempool
 This is the common prefix of a memory pool context. The same note as that for the mem structure applies. More...

Defines

#define ISC_MEM_H   1
#define ISC_MEM_LOWATER   0
#define ISC_MEM_HIWATER   1
#define ISC_MEM_TRACKLINES   1
 Define ISC_MEM_TRACKLINES=1 to turn on detailed tracing of memory allocation and freeing by file and line number.
#define ISC_MEM_CHECKOVERRUN   1
 Define ISC_MEM_CHECKOVERRUN=1 to turn on checks for using memory outside the requested space. This will increase the size of each allocation.
#define ISC_MEM_FILL   1
 Define ISC_MEM_FILL=1 to fill each block of memory returned to the system with the byte string '0xbe'. This helps track down uninitialized pointers and the like. On freeing memory, the space is filled with '0xde' for the same reasons.
#define ISC_MEMPOOL_NAMES   1
 Define ISC_MEMPOOL_NAMES=1 to make memory pools store a symbolic name so that the leaking pool can be more readily identified in case of a memory leak.
#define _ISC_MEM_FILELINE   , __FILE__, __LINE__
#define _ISC_MEM_FLARG   , const char *, unsigned int
#define ISC_MEM_USE_INTERNAL_MALLOC   1
#define ISC_MEMFLAG_NOLOCK   0x00000001
#define ISC_MEMFLAG_INTERNAL   0x00000002
#define ISC_MEMFLAG_DEFAULT   ISC_MEMFLAG_INTERNAL
 We use either isc___mem (three underscores) or isc__mem (two) depending on whether it's for BIND9's internal purpose (with -DBIND9) or generic export library.
#define ISCMEMFUNC(sfx)   isc__mem_ ## sfx
#define ISCMEMPOOLFUNC(sfx)   isc__mempool_ ## sfx
#define isc_mem_get(c, s)   ISCMEMFUNC(get)((c), (s) _ISC_MEM_FILELINE)
#define isc_mem_allocate(c, s)   ISCMEMFUNC(allocate)((c), (s) _ISC_MEM_FILELINE)
#define isc_mem_reallocate(c, p, s)   ISCMEMFUNC(reallocate)((c), (p), (s) _ISC_MEM_FILELINE)
#define isc_mem_strdup(c, p)   ISCMEMFUNC(strdup)((c), (p) _ISC_MEM_FILELINE)
#define isc_mempool_get(c)   ISCMEMPOOLFUNC(get)((c) _ISC_MEM_FILELINE)
#define ISCAPI_MCTX_MAGIC   ISC_MAGIC('A','m','c','x')
#define ISCAPI_MCTX_VALID(m)
#define ISCAPI_MPOOL_MAGIC   ISC_MAGIC('A','m','p','l')
#define ISCAPI_MPOOL_VALID(mp)
#define isc_mem_put(c, p, s)
#define isc_mem_putanddetach(c, p, s)
#define isc_mem_free(c, p)
#define isc_mempool_put(c, p)
#define ISC_MEM_DEBUGTRACE   0x00000001U
#define ISC_MEM_DEBUGRECORD   0x00000002U
#define ISC_MEM_DEBUGUSAGE   0x00000004U
#define ISC_MEM_DEBUGSIZE   0x00000008U
#define ISC_MEM_DEBUGCTX   0x00000010U
#define ISC_MEM_DEBUGALL   0x0000001FU

Typedefs

typedef void(* isc_mem_water_t )(void *, int)
typedef void *(* isc_memalloc_t )(void *, size_t)
typedef void(* isc_memfree_t )(void *, void *)
typedef struct isc_memmethods isc_memmethods_t
typedef struct isc_mempoolmethods isc_mempoolmethods_t
typedef isc_result_t(* isc_memcreatefunc_t )(size_t init_max_size, size_t target_size, isc_mem_t **ctxp, unsigned int flags)

Functions

void isc_mem_destroy (isc_mem_t **)
 Destroy a memory context.
isc_result_t isc_mem_ondestroy (isc_mem_t *ctx, isc_task_t *task, isc_event_t **event)
 Request to be notified with an event when a memory context has been successfully destroyed.
void isc_mem_stats (isc_mem_t *mctx, FILE *out)
 Print memory usage statistics for 'mctx' on the stream 'out'.
void isc_mem_setdestroycheck (isc_mem_t *mctx, isc_boolean_t on)
 If 'on' is ISC_TRUE, 'mctx' will check for memory leaks when destroyed and abort the program if any are present.
size_t isc_mem_inuse (isc_mem_t *mctx)
 Get an estimate of the amount of memory in use in 'mctx', in bytes. This includes quantization overhead, but does not include memory allocated from the system but not yet used.
size_t isc_mem_maxinuse (isc_mem_t *mctx)
 Get an estimate of the largest amount of memory that has been in use in 'mctx' at any time.
size_t isc_mem_total (isc_mem_t *mctx)
 Get the total amount of memory in 'mctx', in bytes, including memory not yet used.
isc_boolean_t isc_mem_isovermem (isc_mem_t *mctx)
 Return true iff the memory context is in "over memory" state, i.e., a hiwater mark has been set and the used amount of memory has exceeds the mark.
void isc_mem_setwater (isc_mem_t *mctx, isc_mem_water_t water, void *water_arg, size_t hiwater, size_t lowater)
 Set high and low water marks for this memory context.
void isc_mem_waterack (isc_mem_t *ctx, int mark)
 Called to acknowledge changes in signaled by calls to 'water'.
void isc_mem_printactive (isc_mem_t *mctx, FILE *file)
 Print to 'file' all active memory in 'mctx'.
void isc_mem_printallactive (FILE *file)
 Print to 'file' all active memory in all contexts.
void isc_mem_checkdestroyed (FILE *file)
 Check that all memory contexts have been destroyed. Prints out those that have not been. Fatally fails if there are still active contexts.
unsigned int isc_mem_references (isc_mem_t *ctx)
 Return the current reference count.
void isc_mem_setname (isc_mem_t *ctx, const char *name, void *tag)
 Name 'ctx'.
const char * isc_mem_getname (isc_mem_t *ctx)
 Get the name of 'ctx', as previously set using isc_mem_setname().
void * isc_mem_gettag (isc_mem_t *ctx)
 Get the tag value for 'task', as previously set using isc_mem_setname().
isc_result_t isc_mempool_create (isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp)
 Create a memory pool.
void isc_mempool_destroy (isc_mempool_t **mpctxp)
 Destroy a memory pool.
void isc_mempool_setname (isc_mempool_t *mpctx, const char *name)
 Associate a name with a memory pool. At most 15 characters may be used.
void isc_mempool_associatelock (isc_mempool_t *mpctx, isc_mutex_t *lock)
 Associate a lock with this memory pool.
unsigned int isc_mempool_getfreemax (isc_mempool_t *mpctx)
 Returns the maximum allowed size of the free list.
void isc_mempool_setfreemax (isc_mempool_t *mpctx, unsigned int limit)
 Sets the maximum allowed size of the free list.
unsigned int isc_mempool_getfreecount (isc_mempool_t *mpctx)
 Returns current size of the free list.
unsigned int isc_mempool_getmaxalloc (isc_mempool_t *mpctx)
void isc_mempool_setmaxalloc (isc_mempool_t *mpctx, unsigned int limit)
 Sets the maximum allowed number of allocations.
unsigned int isc_mempool_getallocated (isc_mempool_t *mpctx)
 Returns the number of items allocated from this pool.
unsigned int isc_mempool_getfillcount (isc_mempool_t *mpctx)
 Returns the number of items allocated as a block from the parent memory context when the free list is empty.
void isc_mempool_setfillcount (isc_mempool_t *mpctx, unsigned int limit)
 Sets the fillcount.
void *ISCMEMFUNC() get (isc_mem_t *, size_t _ISC_MEM_FLARG)
void ISCMEMFUNC() putanddetach (isc_mem_t **, void *, size_t _ISC_MEM_FLARG)
void ISCMEMFUNC() put (isc_mem_t *, void *, size_t _ISC_MEM_FLARG)
void *ISCMEMFUNC() allocate (isc_mem_t *, size_t _ISC_MEM_FLARG)
void *ISCMEMFUNC() reallocate (isc_mem_t *, void *, size_t _ISC_MEM_FLARG)
void ISCMEMFUNC() free (isc_mem_t *, void *_ISC_MEM_FLARG)
char *ISCMEMFUNC() strdup (isc_mem_t *, const char *_ISC_MEM_FLARG)
void *ISCMEMPOOLFUNC() get (isc_mempool_t *_ISC_MEM_FLARG)
void ISCMEMPOOLFUNC() put (isc_mempool_t *, void *_ISC_MEM_FLARG)
 See isc_mem_create2() above.
isc_result_t isc_mem_register (isc_memcreatefunc_t createfunc)
 Register a new memory management implementation and add it to the list of supported implementations. This function must be called when a different memory management library is used than the one contained in the ISC library.
isc_result_t isc__mem_register (void)
 A short cut function that specifies the memory management module in the ISC library for isc_mem_register(). An application that uses the ISC library usually do not have to care about this function: it would call isc_lib_register(), which internally calls this function.
isc_result_t isc_mem_create (size_t max_size, size_t target_size, isc_mem_t **mctxp)
isc_result_t isc_mem_create2 (size_t max_size, size_t target_size, isc_mem_t **mctxp, unsigned int flags)
isc_result_t isc_mem_createx (size_t max_size, size_t target_size, isc_memalloc_t memalloc, isc_memfree_t memfree, void *arg, isc_mem_t **mctxp)
isc_result_t isc_mem_createx2 (size_t max_size, size_t target_size, isc_memalloc_t memalloc, isc_memfree_t memfree, void *arg, isc_mem_t **mctxp, unsigned int flags)
 Create a memory context.
void isc_mem_attach (isc_mem_t *, isc_mem_t **)
void isc_mem_detach (isc_mem_t **)
 Attach to / detach from a memory context.
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.

Variables

LIBISC_EXTERNAL_DATA unsigned int isc_mem_debugging
LIBISC_EXTERNAL_DATA unsigned int isc_mem_defaultflags


Detailed Description

Definition in file mem.h.


Define Documentation

#define ISC_MEM_H   1

Definition at line 19 of file mem.h.

#define ISC_MEM_LOWATER   0

Definition at line 34 of file mem.h.

#define ISC_MEM_HIWATER   1

Definition at line 35 of file mem.h.

Referenced by water().

#define ISC_MEM_TRACKLINES   1

Define ISC_MEM_TRACKLINES=1 to turn on detailed tracing of memory allocation and freeing by file and line number.

Definition at line 46 of file mem.h.

#define ISC_MEM_CHECKOVERRUN   1

Define ISC_MEM_CHECKOVERRUN=1 to turn on checks for using memory outside the requested space. This will increase the size of each allocation.

If we are performing a Coverity static analysis then ISC_MEM_CHECKOVERRUN can hide bugs that would otherwise discovered so force to zero.

Definition at line 61 of file mem.h.

#define ISC_MEM_FILL   1

Define ISC_MEM_FILL=1 to fill each block of memory returned to the system with the byte string '0xbe'. This helps track down uninitialized pointers and the like. On freeing memory, the space is filled with '0xde' for the same reasons.

If we are performing a Coverity static analysis then ISC_MEM_FILL can hide bugs that would otherwise discovered so force to zero.

Definition at line 78 of file mem.h.

#define ISC_MEMPOOL_NAMES   1

Define ISC_MEMPOOL_NAMES=1 to make memory pools store a symbolic name so that the leaking pool can be more readily identified in case of a memory leak.

Definition at line 87 of file mem.h.

Referenced by isc_mem_stats().

#define ISC_MEM_DEBUGTRACE   0x00000001U

Definition at line 94 of file mem.h.

Referenced by main(), pre_parse_args(), and preparse_args().

#define ISC_MEM_DEBUGRECORD   0x00000002U

Definition at line 95 of file mem.h.

Referenced by ATF_TC_BODY(), dns_test_begin(), isc_test_begin(), load_configuration(), main(), pre_parse_args(), and preparse_args().

#define ISC_MEM_DEBUGUSAGE   0x00000004U

Definition at line 96 of file mem.h.

Referenced by main(), and pre_parse_args().

#define ISC_MEM_DEBUGSIZE   0x00000008U

Definition at line 97 of file mem.h.

Referenced by isc___mem_putanddetach(), and main().

#define ISC_MEM_DEBUGCTX   0x00000010U

Definition at line 98 of file mem.h.

Referenced by isc___mem_putanddetach(), main(), and mem_allocateunlocked().

#define ISC_MEM_DEBUGALL   0x0000001FU

The variable isc_mem_debugging holds a set of flags for turning certain memory debugging options on or off at runtime. It is initialized to the value ISC_MEM_DEGBUGGING, which is 0 by default but may be overridden at compile time. The following flags can be specified:

Definition at line 99 of file mem.h.

#define _ISC_MEM_FILELINE   , __FILE__, __LINE__

Definition at line 129 of file mem.h.

#define _ISC_MEM_FLARG   , const char *, unsigned int

Definition at line 130 of file mem.h.

#define ISC_MEM_USE_INTERNAL_MALLOC   1

Define ISC_MEM_USE_INTERNAL_MALLOC=1 to use the internal malloc() implementation in preference to the system one. The internal malloc() is very space-efficient, and quite fast on uniprocessor systems. It performs poorly on multiprocessor machines. JT: we can overcome the performance issue on multiprocessor machines by carefully separating memory contexts.

Definition at line 145 of file mem.h.

#define ISC_MEMFLAG_NOLOCK   0x00000001

Definition at line 151 of file mem.h.

#define ISC_MEMFLAG_INTERNAL   0x00000002

Definition at line 152 of file mem.h.

#define ISC_MEMFLAG_DEFAULT   ISC_MEMFLAG_INTERNAL

We use either isc___mem (three underscores) or isc__mem (two) depending on whether it's for BIND9's internal purpose (with -DBIND9) or generic export library.

Definition at line 154 of file mem.h.

#define ISCMEMFUNC ( sfx   )     isc__mem_ ## sfx

Definition at line 164 of file mem.h.

#define ISCMEMPOOLFUNC ( sfx   )     isc__mempool_ ## sfx

Definition at line 165 of file mem.h.

#define isc_mem_get ( c,
s   )     ISCMEMFUNC(get)((c), (s) _ISC_MEM_FILELINE)

Definition at line 167 of file mem.h.

Referenced by _new_prefix(), add_bad(), add_bad_edns(), add_changed(), add_initial_keys(), add_listener(), add_nm(), add_triededns(), add_triededns512(), add_view_tolist(), add_zone_tolist(), addclosest(), addnoqname(), alloc_pool(), allocate_version(), allrdatasets(), assignchannel(), assignwork(), ATF_TC_BODY(), axfr_rrstream_create(), badcache_resize(), beginload(), blockfrequency(), build_event(), builtin_create(), cfg_aclconfctx_create(), cfg_create_obj(), cfg_create_tuple(), cfg_parser_create(), client_allocsendbuf(), client_create(), client_resfind(), compound_rrstream_create(), configure_forward(), configure_rpz_zone(), configure_session_key(), configure_staticstub_serveraddrs(), configure_staticstub_servernames(), configure_view(), configure_zone_ssutable(), control_recvmessage(), controlkeylist_fromcfg(), copy_ptr_targets(), create_listelt(), create_node(), create_stats(), create_string(), createiterator(), createnode(), dispatch_createudp(), dns64_aaaaok(), dns_acache_create(), dns_acache_createentry(), dns_acache_setdb(), dns_acache_setentry(), dns_acl_create(), dns_acl_merge(), dns_adb_create(), dns_adb_setsit(), dns_badcache_add(), dns_badcache_init(), dns_byaddr_create(), dns_cache_create3(), dns_client_createx2(), dns_client_request(), dns_client_resolve(), dns_client_startrequest(), dns_client_startresolve(), dns_client_startupdate(), dns_client_update(), dns_client_updaterec(), dns_compress_add(), dns_db_register(), dns_dbtable_create(), dns_diff_print(), dns_diff_sort(), dns_dispatchmgr_create(), dns_dispatchmgr_setavailports(), dns_dispatchset_create(), dns_dlzcreate(), dns_dlzregister(), dns_dlzstrtoargvsub(), dns_dns64_create(), dns_dnssec_sign(), dns_dnssec_signmessage(), dns_dnsseckey_create(), dns_ecdb_create(), dns_fwdtable_add(), dns_fwdtable_addfwd(), dns_fwdtable_create(), dns_iptable_create(), dns_journal_compact(), dns_journal_writediff(), dns_keynode_create(), dns_keytable_create(), dns_lookup_create(), dns_master_dumpnodetostream(), dns_master_stylecreate2(), dns_message_create(), dns_message_parse(), dns_name_dup(), dns_name_dupwithoffsets(), dns_name_settotextfilter(), dns_ntatable_create(), dns_order_add(), dns_order_create(), dns_peer_newprefix(), dns_peer_setkeybycharp(), dns_peer_setnotifysource(), dns_peer_setquerysource(), dns_peer_settransfersource(), dns_peerlist_new(), dns_portlist_add(), dns_portlist_create(), dns_rbt_create(), dns_rbtdb_create(), dns_rdataslab_fromrdataset(), dns_rdataslab_merge(), dns_rdataslab_subtract(), dns_requestmgr_create(), dns_resolver_addalternate(), dns_resolver_create(), dns_resolver_createfetch3(), dns_resolver_disable_algorithm(), dns_resolver_disable_ds_digest(), dns_resolver_prime(), dns_rpz_new_zones(), dns_rrl_init(), dns_sdb_create(), dns_sdb_putrdata(), dns_sdb_putrr(), dns_sdb_register(), dns_sdlz_putnamedrr(), dns_sdlz_putrr(), dns_sdlzcreateDBP(), dns_sdlzregister(), dns_ssutable_addrule(), dns_ssutable_create(), dns_ssutable_createdlz(), dns_stats_alloccounters(), dns_tkey_builddhquery(), dns_tkey_processdhresponse(), dns_tkeyctx_create(), dns_tsec_create(), dns_tsig_sign(), dns_tsigkey_createfromkey(), dns_tsigkeyring_create(), dns_update_signaturesinc(), dns_validator_create(), dns_view_adddelegationonly(), dns_view_create(), dns_view_excludedelegationonly(), dns_zone_asyncload(), dns_zone_create(), dns_zone_forwardupdate(), dns_zone_setdbtype(), dns_zone_setmasterswithkeys(), dns_zonemgr_create(), dns_zt_create(), dst__privstruct_parse(), dst_context_create4(), dst_key_fromnamedfile(), dump_rdataset(), dump_rdataset_raw(), dumpctx_create(), dumptostreaminc(), evaluate_local(), evaluate_server(), expand_entries(), expand_rrl_hash(), fctx_create(), fctx_query(), findnode(), generate(), get_key_struct(), get_rndckey(), getbuf4(), getnode(), getnodedata(), getrdataset(), grow_data(), grow_entries(), grow_headerspace(), grow_names(), grow_rdata(), grow_rdatalist(), grow_table(), hmacmd5_createctx(), hmacmd5_fromdns(), hmacsha1_createctx(), hmacsha1_fromdns(), hmacsha224_createctx(), hmacsha224_fromdns(), hmacsha256_createctx(), hmacsha256_fromdns(), hmacsha384_createctx(), hmacsha384_fromdns(), hmacsha512_createctx(), hmacsha512_fromdns(), incctx_create(), insert_nodes(), isc__mempool_create(), isc__task_create(), isc__taskmgr_create(), isc__timer_create(), isc__timermgr_create(), isc_buffer_allocate(), isc_buffer_reallocate(), isc_counter_create(), isc_entropy_create(), isc_entropy_createcallbacksource(), isc_entropy_createfilesource(), isc_entropy_createsamplesource(), isc_event_allocate(), isc_event_constallocate(), isc_hash_ctxcreate(), isc_heap_create(), isc_httpd_accept(), isc_httpdmgr_addurl2(), isc_httpdmgr_create(), isc_interfaceiter_create(), isc_lex_create(), ISC_LIST(), isc_log_create(), isc_log_createchannel(), isc_log_doit(), isc_logconfig_create(), isc_portset_create(), isc_radix_create(), isc_radix_insert(), isc_ratelimiter_create(), isc_rng_create(), isc_symtab_create(), isc_symtab_define(), iterate_node(), ixfr_rrstream_create(), journal_file_create(), journal_open(), listener_create(), load_raw(), load_text(), load_zones(), loadctx_create(), log_nsid(), logfmtpacket(), lookup_done(), main(), make_log_buf(), mem_alloc(), msgblock_allocate(), new_node(), new_rdataset(), new_request(), new_source(), newconnection(), notify_create(), ns__lwresd_memalloc(), ns_add_reserved_dispatch(), ns_client_dumpmessage(), ns_clientmgr_create(), ns_config_getipandkeylist(), ns_config_getiplist(), ns_controls_create(), ns_interface_create(), ns_interfacemgr_create(), ns_listenelt_create(), ns_listenlist_create(), ns_lwdclientmgr_create(), ns_lwdmanager_create(), ns_lwsearchlist_append(), ns_lwsearchlist_create(), ns_query(), ns_server_create(), ns_server_dumpdb(), ns_tkeyctx_fromconfig(), ns_zone_configure(), nta_create(), parse_token(), parse_updatepolicy(), pk11_mem_get(), pk11_parse_uri(), process_dhtkey(), process_gsstkey(), push_attribute(), qid_allocate(), query_newdbversion(), rdataset_setadditional(), rdataset_to_sortedarray(), record_nsec3(), recv_length(), recvsoa(), register_keys(), resize(), resolveaddr_done(), rpz_rewrite(), samplesource_allocate(), save_nsec3param(), sendrequest(), set_addrkeylist(), setup_entropy(), setup_listenon(), setup_newzones(), setup_system(), setup_watcher(), signset(), size_buffer(), soa_rrstream_create(), sort_addresses(), strtoargvsub(), sync_channellist(), test_context_setup(), towiresorted(), valcreate(), validate(), validate_masters(), writeheader(), writeset(), xfrin_create(), xfrout_ctx_create(), zone_addnsec3chain(), zone_refreshkeys(), zone_registerinclude(), zone_saveunique(), zone_startload(), and zonemgr_getio().

#define isc_mem_allocate ( c,
s   )     ISCMEMFUNC(allocate)((c), (s) _ISC_MEM_FILELINE)

Definition at line 168 of file mem.h.

Referenced by ATF_TC_BODY(), clone_buffer(), clone_lookup(), default_journal(), dns_difftuple_create(), dns_keydata_fromdnskey(), dns_keydata_todnskey(), dns_name_tostring(), dns_ssu_external_match(), dns_zone_getdbtype(), evaluate_key(), get_next_command(), isc__taskmgr_create(), isc_file_splitpath(), isc_string_regiondup(), main(), make_empty_lookup(), make_searchlist_entry(), make_server(), mem_maybedup(), ns_zone_configure(), opentmp(), parse_netprefix(), read_sessionkey(), recv_done(), save_opt(), setup_keystr(), setup_lookup(), and setup_text_key().

#define isc_mem_reallocate ( c,
p,
s   )     ISCMEMFUNC(reallocate)((c), (p), (s) _ISC_MEM_FILELINE)

Definition at line 169 of file mem.h.

#define isc_mem_strdup ( c,
 )     ISCMEMFUNC(strdup)((c), (p) _ISC_MEM_FILELINE)

Definition at line 170 of file mem.h.

Referenced by add(), ATF_TC_BODY(), builtin_create(), check_keylist(), check_lockfile(), check_ns(), configure_session_key(), configure_view(), controlkeylist_fromcfg(), convert_named_acl(), dns_cache_create3(), dns_cache_setfilename(), dns_dlzcreate(), dns_master_dumpinc3(), dns_sdb_create(), dns_view_create(), dns_view_setnewzones(), dns_zone_setclass(), dns_zone_setdbtype(), dns_zone_setorigin(), dns_zone_setstring(), dns_zone_settype(), dns_zone_setview(), evaluate_realm(), fctx_create(), get_rndckey(), include_callback(), insert_nodes(), isc_file_splitpath(), isc_httpdmgr_addurl2(), isc_lex_setsourcename(), isc_log_createchannel(), isc_log_settag(), journal_open(), load_text(), main(), nameexist(), new_source(), ns_server_create(), ns_tkeyctx_fromconfig(), ns_zone_configure(), setstring(), zone_dump(), and zone_registerinclude().

#define isc_mempool_get (  )     ISCMEMPOOLFUNC(get)((c) _ISC_MEM_FILELINE)

Definition at line 171 of file mem.h.

Referenced by allocate_devent(), allocate_sevent(), allocate_udp_buffer(), dispatch_allocate(), dns_dispatch_addresponse3(), dns_message_gettempname(), dns_message_gettemprdataset(), get_dispsocket(), getquestions(), getsection(), new_adbaddrinfo(), new_adbentry(), new_adbfetch(), new_adbfind(), new_adblameinfo(), new_adbname(), new_adbnamehook(), new_portentry(), and setup_lookup().

#define ISCAPI_MCTX_MAGIC   ISC_MAGIC('A','m','c','x')

Definition at line 255 of file mem.h.

#define ISCAPI_MCTX_VALID (  ) 

Value:

((m) != NULL && \
                                 (m)->magic == ISCAPI_MCTX_MAGIC)

Definition at line 256 of file mem.h.

#define ISCAPI_MPOOL_MAGIC   ISC_MAGIC('A','m','p','l')

Definition at line 269 of file mem.h.

Referenced by isc__mempool_create().

#define ISCAPI_MPOOL_VALID ( mp   ) 

Value:

((mp) != NULL && \
                                 (mp)->magic == ISCAPI_MPOOL_MAGIC)

Definition at line 270 of file mem.h.

#define isc_mem_put ( c,
p,
s   ) 

Value:

do { \
                ISCMEMFUNC(put)((c), (p), (s) _ISC_MEM_FILELINE);       \
                (p) = NULL; \
        } while (0)

Definition at line 273 of file mem.h.

Referenced by _clear_radix(), acache_callback(), acache_cancelentry(), add_initial_keys(), add_listener(), alloc_pool(), allocate_version(), assignwork(), auto_detach(), badcache_resize(), beginload(), bevent_destroy(), blockfrequency(), build_event(), builtin_create(), builtin_destroy(), cache_free(), cfg_aclconfctx_create(), cfg_create_obj(), cfg_create_tuple(), cfg_obj_destroy(), cfg_parse_listelt(), cfg_parse_mapbody(), cidr_free(), cleanup(), cleanup_entropy(), cleanup_session_key(), clear_addresskeylist(), clear_entry(), clearlistenon(), client_create(), client_resfind(), client_send(), client_senddone(), clientmgr_destroy(), closeversion(), configure_forward(), configure_rpz_zone(), configure_staticstub(), configure_view(), configure_zone_ssutable(), control_recvmessage(), copy_ptr_targets(), create_map(), create_stats(), create_string(), createnode(), dbiterator_destroy(), del_cidr(), delete_data(), delete_zoneconf(), destroy(), destroy_client(), destroy_entry(), destroy_mgr(), destroynode(), destroysource(), dispatch_free(), dns64_aaaaok(), dns_acache_create(), dns_acache_createentry(), dns_acache_putdb(), dns_acl_create(), dns_acl_merge(), dns_adb_create(), dns_adb_setsit(), dns_badcache_add(), dns_badcache_destroy(), dns_badcache_find(), dns_badcache_flush(), dns_badcache_flushname(), dns_badcache_flushtree(), dns_badcache_print(), dns_cache_create3(), dns_client_createx2(), dns_client_destroyreqtrans(), dns_client_destroyrestrans(), dns_client_destroyupdatetrans(), dns_client_freeresanswer(), dns_client_request(), dns_client_resolve(), dns_client_startrequest(), dns_client_startresolve(), dns_client_startupdate(), dns_client_update(), dns_compress_add(), dns_compress_invalidate(), dns_compress_rollback(), dns_db_unregister(), dns_diff_print(), dns_diff_sort(), dns_dispatchmgr_create(), dns_dispatchmgr_setavailports(), dns_dispatchset_create(), dns_dispatchset_destroy(), dns_dlzcreate(), dns_dlzdestroy(), dns_dlzunregister(), dns_dnssec_sign(), dns_dnssec_signmessage(), dns_dnssec_verify3(), dns_dnsseckey_destroy(), dns_ecdb_create(), dns_fwdtable_add(), dns_fwdtable_addfwd(), dns_fwdtable_create(), dns_fwdtable_destroy(), dns_journal_compact(), dns_journal_destroy(), dns_journal_print(), dns_journal_writediff(), dns_keynode_detach(), dns_master_dumpnodetostream(), dns_master_styledestroy(), dns_name_free(), dns_name_settotextfilter(), dns_ntatable_create(), dns_ntatable_detach(), dns_order_create(), dns_order_detach(), dns_peer_setkey(), dns_peer_setkeybycharp(), dns_peer_setnotifysource(), dns_peer_setquerysource(), dns_peer_settransfersource(), dns_portlist_add(), dns_portlist_create(), dns_portlist_detach(), dns_rbt_destroy2(), dns_rbtdb_create(), dns_rdataslab_fromrdataset(), dns_rdataslab_merge(), dns_rdataslab_subtract(), dns_requestmgr_create(), dns_resolver_addalternate(), dns_resolver_create(), dns_resolver_disable_algorithm(), dns_resolver_disable_ds_digest(), dns_rpz_new_zones(), dns_rrl_view_destroy(), dns_sdb_create(), dns_sdb_putrdata(), dns_sdb_putrr(), dns_sdb_register(), dns_sdb_unregister(), dns_sdlz_putnamedrr(), dns_sdlz_putrr(), dns_sdlzcreateDBP(), dns_sdlzregister(), dns_sdlzunregister(), dns_ssutable_addrule(), dns_ssutable_create(), dns_stats_freecounters(), dns_tcpmsg_invalidate(), dns_tcpmsg_readmessage(), dns_tkey_builddhquery(), dns_tkey_processdhresponse(), dns_tkey_processquery(), dns_tkeyctx_destroy(), dns_tsec_create(), dns_tsec_destroy(), dns_tsig_sign(), dns_tsigkey_createfromkey(), dns_tsigkeyring_create(), dns_update_signaturesinc(), dns_validator_create(), dns_view_adddelegationonly(), dns_view_excludedelegationonly(), dns_zone_asyncload(), dns_zone_setdbtype(), dns_zone_setmasterswithkeys(), dns_zonemgr_create(), dns_zt_create(), doshutdown(), dst__privstruct_free(), dst__privstruct_parse(), dst_context_create4(), dst_context_destroy(), dst_key_free(), dst_key_fromnamedfile(), dump_key(), dump_rdataset(), dump_rdataset_raw(), dumpcontext_destroy(), dumpctx_create(), dumptostreaminc(), end_reserved_dispatches(), endload(), evaluate_server(), exit_check(), fctx_create(), fctx_destroy(), fctx_query(), findnode(), free_acachearray(), free_adbentry(), free_algorithm(), free_buffer(), free_controlkey(), free_digest(), free_element(), free_listelt(), free_noqname(), free_old_hash(), free_rbtdb(), free_rdataset(), free_socket(), free_string(), free_tuple(), freenode(), generate(), get_key_struct(), getbuf4(), getnode(), getnodedata(), grow_data(), grow_entries(), grow_headerspace(), grow_names(), grow_rdata(), grow_rdatalist(), grow_table(), hmacmd5_destroy(), hmacmd5_destroyctx(), hmacsha1_destroy(), hmacsha1_destroyctx(), hmacsha224_destroy(), hmacsha224_destroyctx(), hmacsha256_destroy(), hmacsha256_destroyctx(), hmacsha384_destroy(), hmacsha384_destroyctx(), hmacsha512_destroy(), hmacsha512_destroyctx(), httpdmgr_destroy(), incctx_destroy(), internal_destroy(), internal_update_callback(), isc__task_create(), isc__task_onshutdown(), isc__taskmgr_create(), isc__timer_create(), isc__timermgr_create(), isc__timermgr_destroy(), isc_buffer_free(), isc_buffer_reallocate(), isc_counter_create(), isc_entropy_create(), isc_entropy_createcallbacksource(), isc_entropy_createsamplesource(), isc_hash_ctxcreate(), isc_heap_destroy(), isc_httpd_accept(), isc_httpdmgr_addurl2(), isc_httpdmgr_create(), isc_interfaceiter_create(), isc_interfaceiter_destroy(), isc_lex_close(), isc_lex_create(), isc_lex_destroy(), isc_log_createchannel(), isc_log_destroy(), isc_log_doit(), isc_logconfig_destroy(), isc_pool_destroy(), isc_portset_destroy(), isc_radix_insert(), isc_radix_remove(), isc_ratelimiter_create(), isc_rng_create(), isc_stats_detach(), isc_symtab_destroy(), isc_symtab_undefine(), isc_taskpool_destroy(), isccc_ccmsg_invalidate(), isccc_ccmsg_readmessage(), iterate_node(), journal_file_create(), journal_open(), keyfetch_done(), levent_destroy(), listener_create(), load_configuration(), load_raw(), load_text(), load_zones(), loadctx_create(), loadctx_destroy(), localrequest_done(), log_nsid(), logfmtpacket(), lookup_done(), lwdclientmgr_destroy(), lwdclientmgr_shutdown_callback(), main(), manager_free(), master_from_servers(), maybe_free_connection(), mem_free(), mgr_destroy(), msgblock_free(), msgreset(), new_source(), newconnection(), notify_destroy(), ns__lwresd_memfree(), ns_add_reserved_dispatch(), ns_client_dumpmessage(), ns_client_sendraw(), ns_clientmgr_create(), ns_config_getipandkeylist(), ns_config_getiplist(), ns_config_putipandkeylist(), ns_config_putiplist(), ns_controls_create(), ns_controls_destroy(), ns_interface_create(), ns_interface_destroy(), ns_listenelt_destroy(), ns_lwdclientmgr_create(), ns_lwdmanager_create(), ns_lwdmanager_detach(), ns_lwreslistener_detach(), ns_lwsearchlist_append(), ns_lwsearchlist_create(), ns_lwsearchlist_detach(), ns_query(), ns_server_destroy(), ns_zone_configure(), nta_create(), nta_detach(), parse_token(), parse_updatepolicy(), peer_delete(), peerlist_delete(), pk11_mem_put(), pk11_parse_uri(), prime_done(), process_dhtkey(), push_attribute(), putrdataset(), qid_allocate(), qid_destroy(), query_freefreeversions(), query_reset(), ratelimiter_free(), rdataset_setadditional(), rdataset_to_sortedarray(), rdatasetiter_destroy(), receive_secure_db(), record_nsec3(), recvsoa(), req_destroy(), resize(), resolve_done(), resquery_destroy(), restore_nsec3param(), roll_forward(), rpz_detach(), rpz_node_deleter(), samplequeue_release(), samplesource_allocate(), save_nsec3param(), search(), set_addrkeylist(), setup_listenon(), setup_system(), setup_watcher(), shutdown_buckets(), shutdown_server(), signset(), size_buffer(), sort_addresses(), stub_callback(), sync_channellist(), task_finished(), test_context_teardown(), towiresorted(), tsigkey_free(), valcreate(), validate_masters(), view_loaded(), writeheader(), writenode(), writeset(), xfrout_ctx_destroy(), zone_addnsec3chain(), zone_asyncload(), zone_free(), zone_freedbargs(), zone_nsec3chain(), zone_postload(), zone_refreshkeys(), zone_registerinclude(), zone_saveunique(), zone_sign(), zone_startload(), zonemgr_free(), zonemgr_getio(), and zonemgr_putio().

#define isc_mem_putanddetach ( c,
p,
s   ) 

Value:

do { \
                ISCMEMFUNC(putanddetach)((c), (p), (s) _ISC_MEM_FILELINE); \
                (p) = NULL; \
        } while (0)

Definition at line 278 of file mem.h.

Referenced by _deref_prefix(), add_listener(), alloc_pool(), axfr_rrstream_destroy(), cache_free(), cfg_aclconfctx_detach(), cfg_parser_create(), cfg_parser_destroy(), client_create(), compound_rrstream_destroy(), dbtable_free(), destroy(), destroy_ecdb(), destroy_iptable(), destroy_listener(), destroyclient(), destroyring(), dns_adb_create(), dns_badcache_destroy(), dns_badcache_init(), dns_byaddr_create(), dns_byaddr_destroy(), dns_cache_create3(), dns_client_freeupdate(), dns_dbtable_create(), dns_dispatchset_destroy(), dns_dns64_destroy(), dns_journal_destroy(), dns_keytable_create(), dns_keytable_detach(), dns_lookup_create(), dns_lookup_destroy(), dns_message_create(), dns_message_destroy(), dns_order_detach(), dns_portlist_detach(), dns_rbt_create(), dns_rbt_destroy2(), dns_resolver_createfetch3(), dns_resolver_destroyfetch(), dns_rpz_detach_rpzs(), dns_rrl_init(), dns_rrl_view_destroy(), dns_stats_detach(), dns_view_create(), dns_zone_create(), dst_key_free(), dumpctx_destroy(), exit_check(), fctx_destroy(), forward_destroy(), free_listener(), free_rbtdb(), httpdmgr_destroy(), isc_heap_destroy(), isc_log_create(), isc_log_destroy(), isc_pool_destroy(), isc_radix_destroy(), isc_stats_detach(), isc_symtab_create(), isc_symtab_destroy(), isc_taskpool_destroy(), ixfr_rrstream_destroy(), journal_open(), maybe_free(), newzone_cfgctx_destroy(), ns_interfacemgr_create(), ns_interfacemgr_destroy(), soa_rrstream_destroy(), tsigkey_free(), xfrin_create(), xfrout_ctx_destroy(), zone_loaddone(), and zt_destroy().

#define isc_mem_free ( c,
 ) 

Value:

do { \
                ISCMEMFUNC(free)((c), (p) _ISC_MEM_FILELINE);   \
                (p) = NULL; \
        } while (0)

Definition at line 283 of file mem.h.

Referenced by add(), ATF_TC_BODY(), builtin_create(), builtin_destroy(), cache_free(), check_dbtype(), check_keylist(), check_ns(), cleanup(), cleanup_session_key(), clear_query(), clear_searchlist(), compare_labelsequences(), configure_view(), controlkeylist_fromcfg(), default_journal(), destroy(), destroy_libs(), destroy_lookup(), dns_cache_create3(), dns_cache_setfilename(), dns_difftuple_free(), dns_dlzdestroy(), dns_journal_destroy(), dns_master_dump3(), dns_master_dumpinc3(), dns_sdb_create(), dns_ssu_external_match(), dns_tkeyctx_destroy(), dns_view_create(), dns_view_setnewzones(), dns_zone_setclass(), dns_zone_setdbtype(), dns_zone_setorigin(), dns_zone_setstring(), dns_zone_settype(), dns_zone_setview(), dst_key_free(), dumpctx_destroy(), evaluate_key(), evaluate_realm(), fctx_create(), fctx_destroy(), flush_lookup_list(), flush_server_list(), free_controlkey(), freekey(), freestruct_any_tsig(), freestruct_caa(), freestruct_cdnskey(), freestruct_cds(), freestruct_cert(), freestruct_dlv(), freestruct_dnskey(), freestruct_ds(), freestruct_gpos(), freestruct_hinfo(), freestruct_hip(), freestruct_in_apl(), freestruct_in_dhcid(), freestruct_in_nsap(), freestruct_in_wks(), freestruct_ipseckey(), freestruct_isdn(), freestruct_key(), freestruct_keydata(), freestruct_naptr(), freestruct_nsec(), freestruct_nsec3(), freestruct_nsec3param(), freestruct_null(), freestruct_nxt(), freestruct_openpgpkey(), freestruct_opt(), freestruct_rrsig(), freestruct_sig(), freestruct_spf(), freestruct_sshfp(), freestruct_tkey(), freestruct_tlsa(), freestruct_txt(), freestruct_unspec(), freestruct_uri(), freestruct_x25(), get_next_command(), httpdmgr_destroy(), isc__taskmgr_create(), isc_file_splitpath(), isc_lex_close(), isc_lex_setsourcename(), isc_log_createchannel(), isc_log_settag(), isc_logconfig_destroy(), journal_open(), load_text(), main(), manager_free(), nameexist(), new_source(), ns_server_destroy(), ns_server_zonestatus(), ns_zone_configure(), opentmp(), plus_option(), read_sessionkey(), remove_nodes(), send_done(), setstring(), setup(), setup_keystr(), setup_text_key(), tostruct_any_tsig(), tostruct_gpos(), tostruct_hinfo(), tostruct_hip(), tostruct_isdn(), tostruct_naptr(), tostruct_nsec3(), tostruct_tkey(), undefine(), zone_dump(), zone_free(), zone_freedbargs(), and zone_postload().

#define isc_mempool_put ( c,
 ) 

Value:

do { \
                ISCMEMPOOLFUNC(put)((c), (p) _ISC_MEM_FILELINE);        \
                (p) = NULL; \
        } while (0)

Definition at line 288 of file mem.h.

Referenced by clear_query(), deref_portentry(), destroy_dispsocket(), destroy_lookup(), dispatch_allocate(), dispatch_free(), dns_dispatch_addresponse3(), dns_dispatch_removeresponse(), dns_message_puttempname(), dns_message_puttemprdataset(), free_adbaddrinfo(), free_adbentry(), free_adbfetch(), free_adbfind(), free_adblameinfo(), free_adbname(), free_adbnamehook(), free_buffer(), free_devent(), free_sevent(), getquestions(), getsection(), msgresetnames(), msgresetopt(), msgresetsigs(), new_adbfind(), new_adblameinfo(), and new_adbname().


Typedef Documentation

typedef void(* isc_mem_water_t)(void *, int)

Definition at line 36 of file mem.h.

typedef void*(* isc_memalloc_t)(void *, size_t)

Definition at line 38 of file mem.h.

typedef void(* isc_memfree_t)(void *, void *)

Definition at line 39 of file mem.h.

typedef struct isc_memmethods isc_memmethods_t

typedef struct isc_mempoolmethods isc_mempoolmethods_t

typedef isc_result_t(* isc_memcreatefunc_t)(size_t init_max_size, size_t target_size, isc_mem_t **ctxp, unsigned int flags)

Definition at line 734 of file mem.h.


Function Documentation

isc_result_t isc_mem_create ( size_t  max_size,
size_t  target_size,
isc_mem_t **  mctxp 
)

Definition at line 2703 of file mem.c.

Referenced by add(), ATF_TC_BODY(), configure_view(), dns_client_create(), dns_resolver_create(), dns_test_begin(), dns_view_createresolver(), get_clientmctx(), initialize(), isc_test_begin(), main(), mctxinit(), random_test(), and setup_libs().

isc_result_t isc_mem_create2 ( size_t  max_size,
size_t  target_size,
isc_mem_t **  mctxp,
unsigned int  flags 
)

Definition at line 2722 of file mem.c.

isc_result_t isc_mem_createx ( size_t  max_size,
size_t  target_size,
isc_memalloc_t  memalloc,
isc_memfree_t  memfree,
void *  arg,
isc_mem_t **  mctxp 
)

Definition at line 882 of file mem.c.

References isc_mem_createx2(), and isc_mem_defaultflags.

isc_result_t isc_mem_createx2 ( size_t  max_size,
size_t  target_size,
isc_memalloc_t  memalloc,
isc_memfree_t  memfree,
void *  arg,
isc_mem_t **  mctxp,
unsigned int  flags 
)

Create a memory context.

'max_size' and 'target_size' are tuning parameters. When ISC_MEMFLAG_INTERNAL is set, allocations smaller than 'max_size' will be satisfied by getting blocks of size 'target_size' from the system allocator and breaking them up into pieces; larger allocations will use the system allocator directly. If 'max_size' and/or 'target_size' are zero, default values will be * used. When ISC_MEMFLAG_INTERNAL is not set, 'target_size' is ignored.

'max_size' is also used to size the statistics arrays and the array used to record active memory when ISC_MEM_DEBUGRECORD is set. Setting 'max_size' too low can have detrimental effects on performance.

A memory context created using isc_mem_createx() will obtain memory from the system by calling 'memalloc' and 'memfree', passing them the argument 'arg'. A memory context created using isc_mem_create() will use the standard library malloc() and free().

If ISC_MEMFLAG_NOLOCK is set in 'flags', the corresponding memory context will be accessed without locking. The user who creates the context must ensure there be no race. Since this can be a source of bug, it is generally inadvisable to use this flag unless the user is very sure about the race condition and the access to the object is highly performance sensitive.

Requires: mctxp != NULL && *mctxp == NULL

Definition at line 892 of file mem.c.

Referenced by ATF_TC_BODY(), dst_lib_init2(), and isc_mem_createx().

void isc_mem_attach ( isc_mem_t ,
isc_mem_t **   
)

Definition at line 2736 of file mem.c.

Referenced by _new_prefix(), add_listener(), alloc_pool(), axfr_rrstream_create(), cfg_aclconfctx_create(), cfg_parser_create(), compound_rrstream_create(), create_stats(), dns_acache_create(), dns_acl_create(), dns_adb_create(), dns_badcache_init(), dns_byaddr_create(), dns_cache_create3(), dns_client_createx2(), dns_client_updaterec(), dns_db_register(), dns_dbtable_create(), dns_difftuple_create(), dns_dispatchmgr_create(), dns_dispatchset_create(), dns_dlzcreate(), dns_dlzregister(), dns_dns64_create(), dns_ecdb_create(), dns_fwdtable_create(), dns_iptable_create(), dns_keytable_create(), dns_lookup_create(), dns_message_create(), dns_order_create(), dns_portlist_create(), dns_rbt_create(), dns_rbtdb_create(), dns_requestmgr_create(), dns_resolver_create(), dns_resolver_createfetch3(), dns_rpz_new_zones(), dns_rrl_init(), dns_sdb_create(), dns_sdb_register(), dns_sdlzcreateDBP(), dns_sdlzregister(), dns_ssutable_create(), dns_tkeyctx_create(), dns_tsigkey_createfromkey(), dns_tsigkeyring_create(), dns_view_create(), dns_zone_create(), dns_zone_forwardupdate(), dns_zonemgr_create(), dns_zonemgr_createzone(), dns_zt_create(), dst_lib_init2(), dumpctx_create(), fctx_create(), get_clientmctx(), get_key_struct(), isc__taskmgr_create(), isc__timermgr_create(), isc_counter_create(), isc_entropy_create(), isc_hash_ctxcreate(), isc_heap_create(), isc_httpdmgr_create(), isc_log_create(), isc_radix_create(), isc_rng_create(), isc_symtab_create(), ixfr_rrstream_create(), journal_open(), keyfetch_done(), listener_create(), loadctx_create(), loadctx_destroy(), new_request(), notify_create(), ns_interfacemgr_create(), ns_lwdmanager_create(), ns_lwsearchlist_create(), pk11_initialize(), setup_newzones(), soa_rrstream_create(), xfrin_create(), xfrout_ctx_create(), and zone_startload().

void isc_mem_detach ( isc_mem_t **   ) 

Attach to / detach from a memory context.

This is intended for applications that use multiple memory contexts in such a way that it is not obvious when the last allocations from a given context has been freed and destroying the context is safe.

Most applications do not need to call these functions as they can simply create a single memory context at the beginning of main() and destroy it at the end of main(), thereby guaranteeing that it is not destroyed while there are outstanding allocations.

Definition at line 2749 of file mem.c.

Referenced by ATF_TC_BODY(), cache_free(), client_create(), clientmgr_destroy(), configure_view(), destroy(), destroy_mgr(), dns_acache_create(), dns_cache_create3(), dns_client_create(), dns_db_unregister(), dns_difftuple_free(), dns_dispatchmgr_create(), dns_dispatchset_create(), dns_dlzdestroy(), dns_dlzunregister(), dns_fwdtable_destroy(), dns_lib_shutdown(), dns_name_destroy(), dns_resolver_create(), dns_sdb_create(), dns_sdb_unregister(), dns_sdlzregister(), dns_sdlzunregister(), dns_tkeyctx_destroy(), dns_view_createresolver(), dns_zonemgr_create(), dns_zonemgr_createzone(), dst_lib_destroy(), free_rbtdb(), initialize(), isc__timermgr_create(), isc__timermgr_destroy(), isc_httpdmgr_create(), keyfetch_done(), loadctx_destroy(), manager_free(), mctxfree(), mgr_destroy(), notify_destroy(), ns_lwdmanager_create(), ns_lwdmanager_detach(), ns_lwreslistener_detach(), ns_lwsearchlist_detach(), pk11_finalize(), req_destroy(), zone_free(), zone_startload(), and zonemgr_free().

void isc_mem_destroy ( isc_mem_t **   ) 

Destroy a memory context.

Definition at line 2761 of file mem.c.

Referenced by ATF_TC_BODY(), cleanup(), destroy_libs(), dns_test_end(), isc_test_end(), and main().

isc_result_t isc_mem_ondestroy ( isc_mem_t ctx,
isc_task_t task,
isc_event_t **  event 
)

Request to be notified with an event when a memory context has been successfully destroyed.

Definition at line 1235 of file mem.c.

void isc_mem_stats ( isc_mem_t mctx,
FILE *  out 
)

Print memory usage statistics for 'mctx' on the stream 'out'.

Definition at line 1397 of file mem.c.

References stats::blocks, stats::freefrags, stats::gets, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_MEMPOOL_NAMES, ISC_MSG_POOLALLOCATED, ISC_MSG_POOLFILLCOUNT, ISC_MSG_POOLFREECOUNT, ISC_MSG_POOLFREEMAX, ISC_MSG_POOLGETS, ISC_MSG_POOLMAXALLOC, ISC_MSG_POOLNAME, ISC_MSG_POOLSIZE, ISC_MSG_POOLSTATS, isc_msgcat_get(), ISC_MSGSET_MEM, isc__mempool::lock, MCTXLOCK, MCTXUNLOCK, REQUIRE, s, stats::totalgets, and VALID_CONTEXT.

Referenced by cleanup(), destroy_libs(), exit_check(), and main().

void isc_mem_setdestroycheck ( isc_mem_t mctx,
isc_boolean_t  on 
)

If 'on' is ISC_TRUE, 'mctx' will check for memory leaks when destroyed and abort the program if any are present.

Definition at line 2773 of file mem.c.

Referenced by dst_lib_init2().

void isc_mem_setquota ( isc_mem_t ,
size_t   
)

Definition at line 1676 of file mem.c.

References MCTXLOCK, MCTXUNLOCK, REQUIRE, and VALID_CONTEXT.

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.

Definition at line 1688 of file mem.c.

size_t isc_mem_inuse ( isc_mem_t mctx  ) 

Get an estimate of the amount of memory in use in 'mctx', in bytes. This includes quantization overhead, but does not include memory allocated from the system but not yet used.

Definition at line 2802 of file mem.c.

Referenced by acache_incremental_cleaning_action(), ATF_TC_BODY(), ATF_TP_ADD_TCS(), begin_cleaning(), dns_cache_dumpstats(), end_cleaning(), incremental_cleaning_action(), and water().

size_t isc_mem_maxinuse ( isc_mem_t mctx  ) 

Get an estimate of the largest amount of memory that has been in use in 'mctx' at any time.

Definition at line 2812 of file mem.c.

Referenced by dns_cache_dumpstats().

size_t isc_mem_total ( isc_mem_t mctx  ) 

Get the total amount of memory in 'mctx', in bytes, including memory not yet used.

Definition at line 2822 of file mem.c.

Referenced by ATF_TC_BODY(), ATF_TP_ADD_TCS(), and dns_cache_dumpstats().

isc_boolean_t isc_mem_isovermem ( isc_mem_t mctx  ) 

Return true iff the memory context is in "over memory" state, i.e., a hiwater mark has been set and the used amount of memory has exceeds the mark.

Definition at line 2832 of file mem.c.

Referenced by addrdataset(), check_stale_name(), clean_namehooks(), dns_adb_destroyfind(), dns_adb_freeaddrinfo(), expirenode(), and link_entry().

void isc_mem_setwater ( isc_mem_t mctx,
isc_mem_water_t  water,
void *  water_arg,
size_t  hiwater,
size_t  lowater 
)

Set high and low water marks for this memory context.

When the memory usage of 'mctx' exceeds 'hiwater', '(water)(water_arg, ISC_MEM_HIWATER)' will be called. 'water' needs to call isc_mem_waterack() with ISC_MEM_HIWATER to acknowledge the state change. 'water' may be called multiple times.

When the usage drops below 'lowater', 'water' will again be called, this time with ISC_MEM_LOWATER. 'water' need to calls isc_mem_waterack() with ISC_MEM_LOWATER to acknowledge the change.

static void water(void *arg, int mark) { struct foo *foo = arg;

LOCK(&foo->marklock); if (foo->mark != mark) { foo->mark = mark; .... isc_mem_waterack(foo->mctx, mark); } UNLOCK(&foo->marklock); }

If 'water' is NULL then 'water_arg', 'hi_water' and 'lo_water' are ignored and the state is reset.

Requires:

'water' is not NULL. hi_water >= lo_water

Definition at line 2780 of file mem.c.

Referenced by cache_free(), destroy(), dns_acache_setcachesize(), dns_acache_shutdown(), dns_adb_setadbsize(), dns_adb_shutdown(), and dns_cache_setcachesize().

void isc_mem_waterack ( isc_mem_t ctx,
int  mark 
)

Called to acknowledge changes in signaled by calls to 'water'.

Definition at line 2792 of file mem.c.

Referenced by water().

void isc_mem_printactive ( isc_mem_t mctx,
FILE *  file 
)

Print to 'file' all active memory in 'mctx'.

Requires ISC_MEM_DEBUGRECORD to have been set.

void isc_mem_printallactive ( FILE *  file  ) 

Print to 'file' all active memory in all contexts.

Requires ISC_MEM_DEBUGRECORD to have been set.

Definition at line 2277 of file mem.c.

Referenced by isc__taskmgr_destroy().

void isc_mem_checkdestroyed ( FILE *  file  ) 

Check that all memory contexts have been destroyed. Prints out those that have not been. Fatally fails if there are still active contexts.

Definition at line 2296 of file mem.c.

Referenced by main().

unsigned int isc_mem_references ( isc_mem_t ctx  ) 

Return the current reference count.

Definition at line 2322 of file mem.c.

Referenced by exit_check().

void isc_mem_setname ( isc_mem_t ctx,
const char *  name,
void *  tag 
)

Name 'ctx'.

Notes:

Requires:

Definition at line 1799 of file mem.c.

Referenced by configure_view(), dns_resolver_create(), dns_view_createresolver(), dst_lib_init2(), get_clientmctx(), main(), mctxinit(), and setup_libs().

const char* isc_mem_getname ( isc_mem_t ctx  ) 

Get the name of 'ctx', as previously set using isc_mem_setname().

Requires:

Returns:

Definition at line 1812 of file mem.c.

void* isc_mem_gettag ( isc_mem_t ctx  ) 

Get the tag value for 'task', as previously set using isc_mem_setname().

Requires:

Notes: Requires:

Definition at line 1824 of file mem.c.

isc_result_t isc_mempool_create ( isc_mem_t mctx,
size_t  size,
isc_mempool_t **  mpctxp 
)

Create a memory pool.

Requires:

Defaults: Returns:

Definition at line 2843 of file mem.c.

Referenced by dispatch_createudp(), dns_dispatchmgr_create(), dns_dispatchmgr_setudp(), dns_message_create(), and setup_libs().

void isc_mempool_destroy ( isc_mempool_t **  mpctxp  ) 

Destroy a memory pool.

Requires:

Definition at line 2850 of file mem.c.

Referenced by destroy(), destroy_disp(), destroy_libs(), destroy_mgr(), dispatch_createudp(), dispatch_free(), dns_adb_create(), dns_dispatchmgr_create(), dns_dispatchmgr_setudp(), dns_message_create(), and dns_message_destroy().

void isc_mempool_setname ( isc_mempool_t mpctx,
const char *  name 
)

Associate a name with a memory pool. At most 15 characters may be used.

Requires:

Definition at line 2892 of file mem.c.

Referenced by dispatch_createudp(), dns_dispatchmgr_create(), dns_dispatchmgr_setudp(), dns_message_create(), and setup_libs().

void isc_mempool_associatelock ( isc_mempool_t mpctx,
isc_mutex_t lock 
)

Associate a lock with this memory pool.

This lock is used when getting or putting items using this memory pool, and it is also used to set or get internal state via the isc_mempool_get*() and isc_mempool_set*() set of functions.

Multiple pools can each share a single lock. For instance, if "manager" type object contained pools for various sizes of events, and each of these pools used a common lock. Note that this lock must NEVER be used by other than mempool routines once it is given to a pool, since that can easily cause double locking.

Requires:

Definition at line 2902 of file mem.c.

Referenced by dispatch_createudp(), dns_dispatchmgr_create(), and dns_dispatchmgr_setudp().

unsigned int isc_mempool_getfreemax ( isc_mempool_t mpctx  ) 

Returns the maximum allowed size of the free list.

Definition at line 2133 of file mem.c.

void isc_mempool_setfreemax ( isc_mempool_t mpctx,
unsigned int  limit 
)

Sets the maximum allowed size of the free list.

Definition at line 2882 of file mem.c.

Referenced by dispatch_createudp(), dns_dispatchmgr_create(), dns_dispatchmgr_setudp(), dns_message_create(), and setup_libs().

unsigned int isc_mempool_getfreecount ( isc_mempool_t mpctx  ) 

Returns current size of the free list.

Definition at line 2151 of file mem.c.

unsigned int isc_mempool_getmaxalloc ( isc_mempool_t mpctx  ) 

Returns the maximum allowed number of allocations.

Definition at line 2186 of file mem.c.

void isc_mempool_setmaxalloc ( isc_mempool_t mpctx,
unsigned int  limit 
)

Sets the maximum allowed number of allocations.

Additional requirements:

Definition at line 2872 of file mem.c.

Referenced by dispatch_createudp(), dns_dispatchmgr_create(), and dns_dispatchmgr_setudp().

unsigned int isc_mempool_getallocated ( isc_mempool_t mpctx  ) 

Returns the number of items allocated from this pool.

Definition at line 2862 of file mem.c.

Referenced by destroy_mgr_ok(), dns_adb_whenshutdown(), dump_adb(), and msgreset().

unsigned int isc_mempool_getfillcount ( isc_mempool_t mpctx  ) 

Returns the number of items allocated as a block from the parent memory context when the free list is empty.

Definition at line 2238 of file mem.c.

void isc_mempool_setfillcount ( isc_mempool_t mpctx,
unsigned int  limit 
)

Sets the fillcount.

Additional requirements:

Definition at line 2912 of file mem.c.

Referenced by dispatch_createudp(), dns_dispatchmgr_create(), dns_dispatchmgr_setudp(), and setup_libs().

void* ISCMEMFUNC() get ( isc_mem_t ,
size_t  _ISC_MEM_FLARG 
)

void ISCMEMFUNC() putanddetach ( isc_mem_t **  ,
void *  ,
size_t  _ISC_MEM_FLARG 
)

void ISCMEMFUNC() put ( isc_mem_t ,
void *  ,
size_t  _ISC_MEM_FLARG 
)

void* ISCMEMFUNC() allocate ( isc_mem_t ,
size_t  _ISC_MEM_FLARG 
)

void* ISCMEMFUNC() reallocate ( isc_mem_t ,
void *  ,
size_t  _ISC_MEM_FLARG 
)

void ISCMEMFUNC() free ( isc_mem_t ,
void *  _ISC_MEM_FLARG 
)

Referenced by cleanup_lockfile(), cleanup_pidfile(), default_memfree(), free_elt(), free_MechTypeList(), free_NegTokenInit(), free_NegTokenResp(), get_next_command(), isc_file_mmap(), isc_file_munmap(), isc_msgcat_close(), isccc_cc_checkdup(), isccc_sexpr_free(), isccc_sexpr_frombinary(), isccc_sexpr_fromstring(), isccc_symtab_create(), isccc_symtab_destroy(), main(), ns_main_setmemstats(), ns_os_openfile(), pk11_mem_put(), and symtab_undefine().

char* ISCMEMFUNC() strdup ( isc_mem_t ,
const char *  _ISC_MEM_FLARG 
)

Referenced by isccc_sexpr_fromstring(), main(), and ns_os_openfile().

void* ISCMEMPOOLFUNC() get ( isc_mempool_t _ISC_MEM_FLARG  ) 

void ISCMEMPOOLFUNC() put ( isc_mempool_t ,
void *  _ISC_MEM_FLARG 
)

See isc_mem_create2() above.

isc_result_t isc_mem_register ( isc_memcreatefunc_t  createfunc  ) 

Register a new memory management implementation and add it to the list of supported implementations. This function must be called when a different memory management library is used than the one contained in the ISC library.

Definition at line 2670 of file mem.c.

References createlock, initialize_action(), isc_once_do, ISC_R_EXISTS, ISC_R_SUCCESS, LOCK, once, RUNTIME_CHECK, and UNLOCK.

isc_result_t isc__mem_register ( void   ) 

A short cut function that specifies the memory management module in the ISC library for isc_mem_register(). An application that uses the ISC library usually do not have to care about this function: it would call isc_lib_register(), which internally calls this function.

Definition at line 2257 of file mem.c.

Referenced by do_register().


Variable Documentation

LIBISC_EXTERNAL_DATA unsigned int isc_mem_debugging

Definition at line 47 of file mem.c.

Referenced by ATF_TC_BODY(), dns_test_begin(), isc___mem_putanddetach(), isc_test_begin(), load_configuration(), main(), mem_allocateunlocked(), parse_command_line(), pre_parse_args(), and preparse_args().

LIBISC_EXTERNAL_DATA unsigned int isc_mem_defaultflags

Definition at line 48 of file mem.c.

Referenced by isc_mem_createx(), and parse_command_line().


Generated on Tue Apr 28 17:41:15 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha