Memory allocation routines for libts. More...
#include <ctype.h>
#include <string.h>
#include <strings.h>
#include "ink_config.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/mman.h>
#include <malloc.h>
Go to the source code of this file.
Defines | |
#define | ATS_MMAP_MAX M_MMAP_MAX |
#define | MADV_NORMAL 0 |
#define | MADV_RANDOM 1 |
#define | MADV_SEQUENTIAL 2 |
#define | MADV_WILLNEED 3 |
#define | MADV_DONTNEED 4 |
#define | ats_strdup(p) _xstrdup((p), -1, NULL) |
#define | ats_strndup(p, n) _xstrdup((p), n, NULL) |
Typedefs | |
typedef struct iovec | IOVec |
Functions | |
void * | ats_malloc (size_t size) |
void * | ats_calloc (size_t nelem, size_t elsize) |
void * | ats_realloc (void *ptr, size_t size) |
void * | ats_memalign (size_t alignment, size_t size) |
void | ats_free (void *ptr) |
void * | ats_free_null (void *ptr) |
void | ats_memalign_free (void *ptr) |
int | ats_mallopt (int param, int value) |
int | ats_msync (caddr_t addr, size_t len, caddr_t end, int flags) |
int | ats_madvise (caddr_t addr, size_t len, int flags) |
int | ats_mlock (caddr_t addr, size_t len) |
static size_t | __attribute__ ((const)) ats_pagesize(void) |
char * | _xstrdup (const char *str, int length, const char *path) |
Memory allocation routines for libts.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file ink_memory.h.
#define ATS_MMAP_MAX M_MMAP_MAX |
Definition at line 55 of file ink_memory.h.
Referenced by adjust_sys_settings().
#define ats_strdup | ( | p | ) | _xstrdup((p), -1, NULL) |
Definition at line 119 of file ink_memory.h.
Referenced by acl_filter_rule::add_argv(), UrlLru::add_stat(), br(), LogFile::change_header(), LogFile::change_name(), ClusterMachine::ClusterMachine(), CongestionControlRecord::CongestionControlRecord(), CongestionEntry::CongestionEntry(), ClusterProcessor::connect(), Diags::Diags(), DNSProcessor::dns_init(), CoreUtils::dump_history(), RemapProcessor::finish_remap(), LogFormat::format_from_specification(), DNSRequestData::get_string(), HttpPagesHandler::handle_callback(), PrefetchTransform::hash_add(), Span::hash_base_string_set(), LogFieldAliasTable::init(), HttpBodySet::init(), CongestionControlRecord::Init(), CacheHostRecord::Init(), Vol::init(), ink_hash_table_replace_string(), InkXmlAttr::InkXmlAttr(), InkXmlConfigFile::InkXmlConfigFile(), InkXmlObject::InkXmlObject(), hostArray::Insert(), Layout::Layout(), layout_relative(), link_string_alloc(), HttpBodyTemplate::load_from_file(), CoreUtils::load_string(), LogFormat::LogFormat(), Machine::Machine(), main(), RegexMatcher< Data, Result >::Match(), UrlMatcher< Data, Result >::Match(), HostLookup::MatchFirst(), acl_filter_rule::name(), HostLookup::NewEntry(), RegexMatcher< Data, Result >::NewEntry(), UrlMatcher< Data, Result >::NewEntry(), CacheDisk::open(), NetVCOptions::operator=(), redirect_tag_str::parse_format_redirect_url(), parse_log_buff(), LogFormat::parse_symbol_string(), plugin_load(), process_arg(), process_mime_block_impl(), Span::read(), read_MachineList(), PrefetchConfiguration::readHtmlTags(), RecAlloc(), RecConfigFileParse(), RecConfigOverrideFromEnvironment(), RecConfigReadBinDir(), RecConfigReadLogDir(), RecConfigReadRuntimeDir(), RecDataSet(), RecDataSetFromFloat(), RecDataSetFromInk64(), RecForceInsert(), HttpConfig::reconfigure(), RecRegisterConfig(), RecSyncConfigToTB(), RecTreeNode::RecTreeNode(), RecursiveHttpGet::RecursiveHttpGetEvent(), referer_info::referer_info(), remap_load_plugin(), remap_parse_config_bti(), remap_plugin_info::remap_plugin_info(), LogObject::rename(), resolve_logfield_string(), LogHost::set_ipstr_port(), LogHost::set_name_port(), set_paths_helper(), SimpleTokenizer::setString(), Span::Span(), ssl_extract_certificate(), ssl_private_key_validate_exec(), SSLParseCertificateConfiguration(), CacheProcessor::start_internal(), synclient_txn_send_request(), synclient_txn_send_request_to_vc(), LogBuffer::to_ascii(), SessionProtocolNameRegistry::toIndex(), TSHttpArgIndexReserve(), TSPluginRegister(), LogConfig::update_space_used(), UrlRewrite::UrlRewrite(), CongestionControlRecord::validate(), UpdateEntry::ValidHeaders(), and UpdateEntry::ValidURL().
#define ats_strndup | ( | p, | ||
n | ||||
) | _xstrdup((p), n, NULL) |
Definition at line 120 of file ink_memory.h.
Referenced by asn1_strdup(), RemapProcessor::finish_remap(), register_ShowHostDB(), register_ShowNet(), and NetVCOptions::set_sni_servername().
#define MADV_DONTNEED 4 |
Definition at line 76 of file ink_memory.h.
#define MADV_NORMAL 0 |
Definition at line 60 of file ink_memory.h.
#define MADV_RANDOM 1 |
Definition at line 64 of file ink_memory.h.
#define MADV_SEQUENTIAL 2 |
Definition at line 68 of file ink_memory.h.
#define MADV_WILLNEED 3 |
Definition at line 72 of file ink_memory.h.
typedef struct iovec IOVec |
Definition at line 83 of file ink_memory.h.
static size_t __attribute__ | ( | (const) | ) | [inline, static] |
Definition at line 98 of file ink_memory.h.
char* _xstrdup | ( | const char * | str, | |
int | length, | |||
const char * | path | |||
) |
Definition at line 228 of file ink_memory.cc.
References ats_malloc(), ink_strlcpy(), and likely.
Referenced by _TSstrdup().
void* ats_calloc | ( | size_t | nelem, | |
size_t | elsize | |||
) |
Definition at line 59 of file ink_memory.cc.
References ink_fatal(), ink_stack_trace_dump(), and unlikely.
Referenced by ClusterMachine::ClusterMachine().
void ats_free | ( | void * | ptr | ) |
Definition at line 120 of file ink_memory.cc.
References likely.
Referenced by _ink_hash_table_free_entry_value(), _ink_hash_table_xfree_entry_value(), _TSfree(), UrlLru::add_stat(), blk_free(), build_vol_hash_table(), ControlMatcher< Data, Result >::BuildTable(), CacheHostTable::BuildTable(), ControlMatcher< Data, Result >::BuildTableFromString(), CacheHostTable::BuildTableFromString(), LogFile::change_header(), LogFile::change_name(), change_uid_gid(), check_lockfile(), StrListOverflow::clean(), FetchSM::cleanUp(), CongestionControlRecord::cleanup(), ClearCacheVolList(), comp_http_hdr(), ShowCont::complete(), ShowCont::complete_error(), RamCacheCLFUS::compress_entries(), LogObject::compute_signature(), cookie_debug(), create_npn_advertisement(), IOBufferData::dealloc(), ParentRecord::DefaultInit(), Store::delete_all(), delete_queue(), dequeue(), HttpTransact::State::destroy(), HTTPCacheAlt::destroy(), HdrHeap::destroy(), FreerContinuation::dieEvent(), Vol::dir_check(), CacheProcessor::diskInitialized(), DNSProcessor::dns_init(), HttpSM::do_redirect(), CoreUtils::dump_history(), HttpSM::dump_state_hdr(), HttpTransact::EndRemapRequest(), FileImpl::fclose(), NetVCTest::fill_buffer(), RemapProcessor::finish_remap(), PrefetchUrlEntry::free(), HashTableEntry< key_t, data_t >::free(), HdrStrHeap::free(), DefaultAlloc::free(), free_CacheVC(), HttpTransact::State::free_internal_msg_buffer(), RamCacheCLFUS::get(), how_to_open_connection(), PrefetchBlaster::init(), HttpBodySet::init(), CacheHostRecord::Init(), SSLConfigParams::initialize(), ink_freelist_free(), ink_hash_table_destroy(), ink_hash_table_replace_string(), HttpTransactHeaders::insert_supported_methods_in_response(), ClusterProcessor::internal_invoke_remote(), HttpSM::kill_this(), link_string_alloc(), HttpBodyTemplate::load_from_file(), CoreUtils::load_http_hdr(), HttpProxyPort::loadConfig(), loadSocksConfiguration(), main(), LogAccess::marshal_config_str_var(), RegexMatcher< Data, Result >::Match(), UrlMatcher< Data, Result >::Match(), CacheHostMatcher::Match(), mime_field_value_extend_comma_val(), mime_scanner_clear(), RegexMatcher< Data, Result >::NewEntry(), NetVCOptions::operator=(), LogFormat::parse_symbol_string(), plugin_init(), CoreUtils::process_EThread(), process_http_hdr_impl(), CoreUtils::process_HttpSM(), process_mime_block_impl(), CoreUtils::process_NetVC(), process_regex_mapping_config(), ParentRecord::ProcessParents(), HTTPInfo::push_frag_offset(), Store::read_config(), ConfigVolumes::read_config_file(), LogConfig::read_configuration_variables(), CoreUtils::read_from_core(), read_MachineList(), PrefetchConfiguration::readConfiguration(), readIntoBuffer(), RecConfigFileParse(), RecCoreInit(), RecDataClear(), RecDataSet(), RecDataSetFromFloat(), RecDataSetFromInk64(), RecFileImport_Xmalloc(), RecForceInsert(), RecGetRecordDefaultDataString_Xmalloc(), RecMessageFree(), RecMessageReadFromDisk(), SocksServerConfig::reconfigure(), ParentConfig::reconfigure(), HttpBodyFactory::reconfigure(), DiagsConfig::reconfigure_diags(), RecReadStatsFile(), RecRegisterConfig(), RecWriteConfigFile(), PrefetchTransform::redirect(), SSLNextProtocolSet::registerEndpoint(), remap_load_plugin(), LogObject::rename(), NetVCOptions::reset(), SocksAddrType::reset(), ICPPeerReadCont::reset(), HttpBodyTemplate::reset(), RamCacheLRU::resize_hashtable(), RamCacheCLFUS::resize_hashtable(), LogBuffer::resolve_custom_entry(), resolve_logfield_string(), BaseStatPagesHandler::resp_clear(), NetVCOptions::set_sni_servername(), HttpSM::setup_internal_transfer(), spawn_thread_internal(), ssl_private_key_validate_exec(), SSLInitializeLibrary(), stat_callback(), synclient_txn_delete(), syslog_log_configure(), LogBuffer::to_ascii(), LogFilterString::toss_this_entry(), ts_host_res_global_init(), TSCacheKeyDestroy(), TSHttpParserDestroy(), TSHttpTxnErrorBodySet(), TSHttpTxnRedirectUrlSet(), TSMatcherLineDestroy(), TSMimeParserDestroy(), TSPluginDirGet(), TSRedirectUrlSet(), TSUrlPercentEncode(), LogConfig::update_space_used(), UrlRewrite::UrlRewrite(), LogFilterString::wipe_this_entry(), write_stats_snap(), CacheDisk::~CacheDisk(), CacheHostRecord::~CacheHostRecord(), ClusterHandler::~ClusterHandler(), ClusterLoadMonitor::~ClusterLoadMonitor(), ClusterMachine::~ClusterMachine(), CongestionEntry::~CongestionEntry(), DFA::~DFA(), Diags::~Diags(), EThread::~EThread(), hostArray::~hostArray(), HostLookup::~HostLookup(), HostLookupState::~HostLookupState(), HttpBodySet::~HttpBodySet(), HttpConfigParams::~HttpConfigParams(), ICPRequestCont::~ICPRequestCont(), InkXmlAttr::~InkXmlAttr(), InkXmlConfigFile::~InkXmlConfigFile(), InkXmlObject::~InkXmlObject(), Layout::~Layout(), LogConfig::~LogConfig(), LogField::~LogField(), LogFile::~LogFile(), LogFilter::~LogFilter(), LogFilterString::~LogFilterString(), LogFormat::~LogFormat(), LogHost::~LogHost(), LogObject::~LogObject(), Machine::~Machine(), MetaInfo::~MetaInfo(), MultiCacheHeapGC::~MultiCacheHeapGC(), NetVCOptions::~NetVCOptions(), ParentRecord::~ParentRecord(), PrefetchTransform::~PrefetchTransform(), RecTreeNode::~RecTreeNode(), redirect_tag_str::~redirect_tag_str(), referer_info::~referer_info(), RegexMatcher< Data, Result >::~RegexMatcher(), remap_plugin_info::~remap_plugin_info(), SessionProtocolNameRegistry::~SessionProtocolNameRegistry(), ShowCont::~ShowCont(), SSLNextProtocolSet::~SSLNextProtocolSet(), textBuffer::~textBuffer(), Tokenizer::~Tokenizer(), UnsunkPtrRegistry::~UnsunkPtrRegistry(), UpdateEntry::~UpdateEntry(), UrlMatcher< Data, Result >::~UrlMatcher(), and UrlRewrite::~UrlRewrite().
void* ats_free_null | ( | void * | ptr | ) |
Definition at line 127 of file ink_memory.cc.
References likely.
Referenced by SSLConfigParams::cleanup(), clear_xstr_array(), HttpBodyFactory::fabricate_with_old_api(), SSLConfigParams::initialize(), acl_filter_rule::name(), remap_parse_config_bti(), and url_mapping::~url_mapping().
int ats_madvise | ( | caddr_t | addr, | |
size_t | len, | |||
int | flags | |||
) |
Definition at line 191 of file ink_memory.cc.
References a.
void* ats_malloc | ( | size_t | size | ) |
Definition at line 36 of file ink_memory.cc.
References ink_fatal(), ink_stack_trace_dump(), likely, and unlikely.
Referenced by _TSmalloc(), _xstrdup(), aio_init_fildes(), IOBufferData::alloc(), HashTableEntry< key_t, data_t >::alloc(), DefaultAlloc::alloc(), UnsunkPtrRegistry::alloc_data(), MIOBuffer::alloc_xmalloc(), RegexMatcher< Data, Result >::AllocateSpace(), CacheContinuation::allocMsgBuffer(), ats_memalign(), blk_alloc(), build_vol_hash_table(), ControlMatcher< Data, Result >::BuildTableFromString(), CacheHostTable::BuildTableFromString(), change_uid_gid(), ClusterHandler::check_channel(), ClusterLoadMonitor::ClusterLoadMonitor(), comp_http_hdr(), RamCacheCLFUS::compress_entries(), LogObject::compute_signature(), cookie_debug(), HTTPCacheAlt::copy_frag_offsets_from(), cplist_init(), cplist_reconfigure(), StrListOverflow::create_heap(), create_npn_advertisement(), create_queue(), ParentRecord::DefaultInit(), Vol::dir_check(), CacheProcessor::diskInitialized(), HttpSM::dump_state_hdr(), Store::dup(), enqueue(), EThread::EThread(), HttpBodyFactory::fabricate_with_old_api(), NetVCTest::fill_buffer(), FileImpl::fread(), FileImpl::fwrite(), RamCacheCLFUS::get(), FetchSM::get_info_from_buffer(), HttpTransact::handle_trace_and_options_requests(), hdrtoken_init(), ParentRecord::Init(), CongestionControlRecord::Init(), CacheHostRecord::Init(), CacheControlRecord::Init(), Vol::init(), initialize_thread_for_net(), ink_freelist_init(), ink_freelist_new(), ink_hash_table_create(), HttpTransactHeaders::insert_supported_methods_in_response(), load_buffer(), HttpBodyTemplate::load_from_file(), CoreUtils::load_http_hdr(), Load_IpMap_From_File(), load_string(), loadSocksAuthInfo(), log_test_handler(), main(), make_vol_map(), CacheHostMatcher::Match(), mime_field_value_extend_comma_val(), mime_init_date_format_table(), mime_scanner_append(), MultiCacheHeapGC::MultiCacheHeapGC(), new_HdrHeap(), new_HdrStrHeap(), IpMatcher< Data, Result >::NewEntry(), RegexMatcher< Data, Result >::NewEntry(), UrlMatcher< Data, Result >::NewEntry(), CacheDisk::open(), Cache::open(), LogFormat::parse_format_string(), parse_log_buff(), HttpConfig::parse_url_expansions(), plugin_expand(), CoreUtils::process_EThread(), CoreUtils::process_HttpSM(), CoreUtils::process_NetVC(), process_regex_mapping_config(), ParentRecord::ProcessParents(), HTTPInfo::push_frag_offset(), RamCacheCLFUS::put(), Store::read(), CoreUtils::read_from_core(), read_MachineList(), PrefetchConfiguration::readHtmlTags(), readIntoBuffer(), IOBufferBlock::realloc_xmalloc(), RecTree::rec_tree_get_list(), RecAllocateRawStatBlock(), RecConfigFileParse(), RecCoreInit(), RecFileImport_Xmalloc(), RecGetRecordDefaultDataString_Xmalloc(), RecGetRecordPrefix_Xmalloc(), RecMessageAlloc(), RecMessageReadFromDisk(), RecRegisterConfigUpdateCb(), RecSyncConfigToTB(), RecWriteConfigFile(), StatPagesManager::register_http(), remap_parse_config_bti(), RamCacheLRU::resize_hashtable(), RamCacheCLFUS::resize_hashtable(), LogBuffer::resolve_custom_entry(), resolve_logfield_string(), BaseStatPagesHandler::resp_add(), SocksProxy::setupHttpRequest(), ShowCont::ShowCont(), SSLInitializeLibrary(), Thread::start(), CacheProcessor::start_internal(), HttpConfig::startup(), stat_callback(), testpage_callback(), textBuffer::textBuffer(), LogFilterString::toss_this_entry(), TSCacheKeyHostNameSet(), TSHttpParserCreate(), TSICPCachedReqGet(), TSICPCachedRespGet(), TSMatcherLineCreate(), TSMimeParserCreate(), TSRedirectUrlSet(), HTTPInfo::unmarshal(), LogConfig::update_space_used(), url_string_get(), url_to_string(), CongestionControlRecord::validate(), LogFilterString::wipe_this_entry(), and write_stats_snap().
int ats_mallopt | ( | int | param, | |
int | value | |||
) |
Definition at line 147 of file ink_memory.cc.
Referenced by adjust_sys_settings().
void* ats_memalign | ( | size_t | alignment, | |
size_t | size | |||
) |
Definition at line 83 of file ink_memory.cc.
References ats_malloc(), ink_fatal(), and unlikely.
Referenced by IOBufferData::alloc(), Vol::handle_recover_from_data(), Vol::init(), ink_freelist_init(), ink_freelist_new(), CacheSync::mainEvent(), MultiCacheBase::mmap_data(), CacheDisk::open(), sync_cache_dir_on_shutdown(), Vol::Vol(), and VolInitInfo::VolInitInfo().
void ats_memalign_free | ( | void * | ptr | ) |
Definition at line 135 of file ink_memory.cc.
References likely.
Referenced by ink_freelist_free(), CacheSync::mainEvent(), sync_cache_dir_on_shutdown(), and Vol::~Vol().
int ats_mlock | ( | caddr_t | addr, | |
size_t | len | |||
) |
Definition at line 213 of file ink_memory.cc.
References a.
int ats_msync | ( | caddr_t | addr, | |
size_t | len, | |||
caddr_t | end, | |||
int | flags | |||
) |
Definition at line 164 of file ink_memory.cc.
References a.
Referenced by MultiCacheSync::heapEvent(), MultiCacheHeapGC::startEvent(), MultiCacheBase::sync_header(), MultiCacheBase::sync_heap(), and MultiCacheBase::sync_partition().
void* ats_realloc | ( | void * | ptr, | |
size_t | size | |||
) |
Definition at line 70 of file ink_memory.cc.
References ink_fatal(), ink_stack_trace_dump(), and unlikely.
Referenced by _TSrealloc(), ClusterHandler::check_channel(), Store::extend(), FileImpl::fread(), mime_scanner_append(), RecMessageMarshal_Realloc(), BaseStatPagesHandler::resp_add(), ShowCont::show(), and SSLInitializeLibrary().