Data Structures | |
struct | regional |
the regional* is the first block*. More... | |
Functions | |
struct regional * | regional_create () |
Create a new regional. | |
struct regional * | regional_create_custom (size_t size) |
Create a new region, with custom settings. | |
void | regional_free_all (struct regional *r) |
Free all memory associated with regional. | |
void | regional_destroy (struct regional *r) |
Destroy regional. | |
void * | regional_alloc (struct regional *r, size_t size) |
Allocate size bytes of memory inside regional. | |
void * | regional_alloc_init (struct regional *r, const void *init, size_t size) |
Allocate size bytes of memory inside regional and copy INIT into it. | |
void * | regional_alloc_zero (struct regional *r, size_t size) |
Allocate size bytes of memory inside regional that are initialized to 0. | |
char * | regional_strdup (struct regional *r, const char *string) |
Duplicate string and allocate the result in regional. | |
void | regional_log_stats (struct regional *r) |
Debug print regional statistics to log. | |
size_t | regional_get_mem (struct regional *r) |
get total memory size in use by region |
Allocates small portions of of larger chunks. Based on region-allocator from NSD, but rewritten to be light.
Different from (nsd) region-allocator.h o does not have recycle bin o does not collect stats; just enough to answer get_mem() in use. o does not keep cleanup list o does not have function pointers to setup o allocs the regional struct inside the first block. o can take a block to create regional from. o blocks and large allocations are kept on singly linked lists.
struct regional* regional_create | ( | ) | [read] |
Create a new regional.
References REGIONAL_CHUNK_SIZE, and regional_create_custom().
Referenced by acl_list_create(), anchors_create(), check_mod(), donotq_create(), dstest_file(), forwards_create(), hints_create(), log_dns_msg(), lz_enter_zone_dname(), nsec3_hash_test(), perf_encode(), perftestpkt(), process_answer_detail(), testpkt(), and verifytest_file().
struct regional* regional_create_custom | ( | size_t | size | ) | [read] |
Create a new region, with custom settings.
size,: | length of first block. |
References regional::first_size, log_assert, and regional_init().
Referenced by alloc_reg_obtain(), libworker_setup(), prealloc_blocks(), regional_create(), and worker_init().
void regional_free_all | ( | struct regional * | r | ) |
Free all memory associated with regional.
Only keeps the first block with the regional inside it.
r,: | the region. |
References regional::large_list, regional::next, and regional_init().
Referenced by acl_list_apply_cfg(), alloc_reg_release(), answer_from_cache(), answer_norec_from_cache(), dstest_entry(), mesh_run(), perf_encode(), regional_destroy(), val_verify_rrset(), and verifytest_entry().
void regional_destroy | ( | struct regional * | r | ) |
Destroy regional.
All memory associated with regional is freed as if regional_free_all was called, as well as destroying the regional struct.
r,: | to delete. |
References regional_free_all().
Referenced by acl_list_delete(), alloc_reg_release(), anchors_delete(), check_mod(), donotq_delete(), dstest_file(), forwards_delete(), hints_delete(), libworker_delete(), local_zone_delete(), log_dns_msg(), nsec3_hash_test(), perf_encode(), perftestpkt(), process_answer_detail(), testpkt(), verifytest_file(), and worker_delete().
void* regional_alloc | ( | struct regional * | r, | |
size_t | size | |||
) |
Allocate size bytes of memory inside regional.
The memory is deallocated when region_free_all is called for this region.
r,: | the region. | |
size,: | number of bytes. |
References ALIGN_UP, ALIGNMENT, regional::available, regional::data, regional::large_list, regional::next, REGIONAL_CHUNK_SIZE, REGIONAL_LARGE_OBJECT_SIZE, and regional::total_large.
Referenced by acl_list_insert(), add_rr_to_rrset(), anchor_new_ta(), anchor_new_ta_key(), assemble_it(), compress_tree_newnode(), construct_reply_info_base(), copy_rrset(), create_msg(), delegpt_add_addr(), delegpt_add_ns(), delegpt_create(), dns_alloc_msg(), dns_copy_msg(), donotq_insert(), ds_digest_match_dnskey(), forwards_insert(), gen_dns_msg(), generate_sub_request(), hints_insert(), insert_rr(), iter_add_prepend_answer(), iter_add_prepend_auth(), iter_new(), iter_prepend(), key_entry_get_rrset(), key_entry_setup(), libworker_send_query(), mesh_state_add_cb(), mesh_state_add_reply(), mesh_state_attachment(), mesh_state_create(), moveover_rrsigs(), new_rrset(), nsec3_calc_hash(), nsec3_ce_wildcard(), nsec3_hash_name(), parse_copy_decompress_rrset(), parse_create_qinfo(), parse_create_rrset(), parse_reply(), process_response(), regional_alloc_init(), regional_alloc_zero(), repinfo_alloc_rrset_keys(), reply_info_parse(), rrset_array_unlock_touch(), rrset_canonical(), synth_cname_rrset(), synth_dname_msg(), val_new(), and worker_send_query().
void* regional_alloc_init | ( | struct regional * | r, | |
const void * | init, | |||
size_t | size | |||
) |
Allocate size bytes of memory inside regional and copy INIT into it.
The memory is deallocated when region_free_all is called for this region.
r,: | the region. | |
init,: | to copy. | |
size,: | number of bytes. |
References regional_alloc().
Referenced by anchor_new_ta(), anchor_new_ta_key(), assemble_it(), copy_rrset(), create_msg(), delegpt_add_ns(), delegpt_set_name(), dns_copy_msg(), forwards_insert(), gen_dns_msg(), hints_insert(), insert_rr(), key_entry_copy_toregion(), key_entry_create_rrset(), key_entry_get_rrset(), key_entry_setup(), lz_find_create_node(), mesh_state_add_reply(), mesh_state_create(), nsec3_calc_b32(), nsec3_hash_test_entry(), process_ds_response(), regional_strdup(), repinfo_copy_rrsets(), synth_dname_msg(), and val_new().
void* regional_alloc_zero | ( | struct regional * | r, | |
size_t | size | |||
) |
Allocate size bytes of memory inside regional that are initialized to 0.
The memory is deallocated when region_free_all is called for this region.
r,: | the region. | |
size,: | number of bytes. |
References regional_alloc().
Referenced by lz_find_create_node(), and new_local_rrset().
char* regional_strdup | ( | struct regional * | r, | |
const char * | string | |||
) |
Duplicate string and allocate the result in regional.
r,: | the region. | |
string,: | null terminated string. |
References regional_alloc_init().