Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/iocore/eventsystem/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class Event : public Action
//
// Event Allocator
//
extern ClassAllocator<Event> eventAllocator;
extern ClassAllocator<Event, false> eventAllocator;

#define EVENT_ALLOC(_a, _t) THREAD_ALLOC(_a, _t)
#define EVENT_FREE(_p, _a, _t) \
Expand Down
4 changes: 2 additions & 2 deletions include/iocore/eventsystem/IOBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class IOBufferData : public RefCountObj
IOBufferData &operator=(const IOBufferData &) = delete;
};

extern ClassAllocator<IOBufferData> ioDataAllocator;
extern ClassAllocator<IOBufferData, false> ioDataAllocator;

/**
A linkable portion of IOBufferData. IOBufferBlock is a chainable
Expand Down Expand Up @@ -494,7 +494,7 @@ class IOBufferBlock : public RefCountObj
IOBufferBlock &operator=(const IOBufferBlock &) = delete;
};

extern ClassAllocator<IOBufferBlock> ioBlockAllocator;
extern ClassAllocator<IOBufferBlock, false> ioBlockAllocator;

/** A class for holding a chain of IO buffer blocks.
This class is intended to be used as a member variable for other classes that
Expand Down
2 changes: 1 addition & 1 deletion include/iocore/eventsystem/Lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class ProxyMutex : public RefCountObj
};

// The ClassAllocator for ProxyMutexes
extern ClassAllocator<ProxyMutex> mutexAllocator;
extern ClassAllocator<ProxyMutex, false> mutexAllocator;

inline bool
Mutex_trylock(
Expand Down
2 changes: 1 addition & 1 deletion include/iocore/utils/OneWayMultiTunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ struct OneWayMultiTunnel : public OneWayTunnel {
VIO *vioTargets[ONE_WAY_MULTI_TUNNEL_LIMIT];
};

extern ClassAllocator<OneWayMultiTunnel> OneWayMultiTunnelAllocator;
extern ClassAllocator<OneWayMultiTunnel, false> OneWayMultiTunnelAllocator;
2 changes: 1 addition & 1 deletion include/proxy/http/Http1ClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ class Http1ClientSession : public ProxySession
Http1ClientTransaction trans;
};

extern ClassAllocator<Http1ClientSession, true> http1ClientSessionAllocator;
extern ClassAllocator<Http1ClientSession> http1ClientSessionAllocator;
2 changes: 1 addition & 1 deletion include/proxy/http/Http1ServerSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Http1ServerSession : public PoolableSession
Http1ServerTransaction trans;
};

extern ClassAllocator<Http1ServerSession, true> httpServerSessionAllocator;
extern ClassAllocator<Http1ServerSession> httpServerSessionAllocator;

////////////////////////////////////////////
// INLINE
Expand Down
2 changes: 1 addition & 1 deletion include/proxy/http/HttpSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class HttpSM : public Continuation, public PluginUserArgs<TS_USER_ARGS_TXN>

public:
HttpSM();
void cleanup();
~HttpSM() override;
virtual void destroy();

static HttpSM *allocate();
Expand Down
9 changes: 6 additions & 3 deletions include/proxy/http/HttpTransact.h
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,8 @@ class HttpTransact
// memset((void *)&host_db_info, 0, sizeof(host_db_info));
}

~State() { destroy(); }

void
destroy()
{
Expand All @@ -857,8 +859,10 @@ class HttpTransact
free_internal_msg_buffer();
ats_free(internal_msg_buffer_type);

ParentConfig::release(parent_params);
parent_params = nullptr;
if (parent_params != nullptr) {
ParentConfig::release(parent_params);
parent_params = nullptr;
}

hdr_info.client_request.destroy();
hdr_info.client_response.destroy();
Expand All @@ -877,7 +881,6 @@ class HttpTransact
url_map.clear();
arena.reset();
unmapped_url.clear();
dns_info.~ResolveInfo();
outbound_conn_track_state.clear();

delete[] ranges;
Expand Down
5 changes: 3 additions & 2 deletions include/proxy/http/PreWarmManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ class PreWarmSM;
class PreWarmManager;
class SNIConfigParams;

extern ClassAllocator<PreWarmSM> preWarmSMAllocator;
extern PreWarmManager prewarmManager;
extern PreWarmManager prewarmManager;

/**
@class PreWarmSM
Expand Down Expand Up @@ -230,6 +229,8 @@ class PreWarmSM : public Continuation
Event *_retry_event = nullptr;
};

extern ClassAllocator<PreWarmSM, false> preWarmSMAllocator;

/**
@class PreWarmQueue
@detail
Expand Down
2 changes: 1 addition & 1 deletion include/proxy/http2/Http2ClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ class Http2ClientSession : public ProxySession, public Http2CommonSession
IpEndpoint cached_local_addr;
};

extern ClassAllocator<Http2ClientSession, true> http2ClientSessionAllocator;
extern ClassAllocator<Http2ClientSession> http2ClientSessionAllocator;
2 changes: 1 addition & 1 deletion include/proxy/http2/Http2ServerSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ class Http2ServerSession : public PoolableSession, public Http2CommonSession
bool in_session_table = false;
};

extern ClassAllocator<Http2ServerSession> http2ServerSessionAllocator;
extern ClassAllocator<Http2ServerSession, false> http2ServerSessionAllocator;
2 changes: 1 addition & 1 deletion include/proxy/http2/Http2Stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class Http2Stream : public ProxyTransaction
Event *_write_vio_event = nullptr;
};

extern ClassAllocator<Http2Stream, true> http2StreamAllocator;
extern ClassAllocator<Http2Stream> http2StreamAllocator;

////////////////////////////////////////////////////
// INLINE
Expand Down
8 changes: 4 additions & 4 deletions include/proxy/http3/Http3Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ using Http3FrameUPtr = std::unique_ptr<Http3Frame, Http3FrameDeleterFunc>
using Http3DataFrameUPtr = std::unique_ptr<Http3DataFrame, Http3FrameDeleterFunc>;
using Http3HeadersFrameUPtr = std::unique_ptr<Http3HeadersFrame, Http3FrameDeleterFunc>;

extern ClassAllocator<Http3Frame> http3FrameAllocator;
extern ClassAllocator<Http3DataFrame> http3DataFrameAllocator;
extern ClassAllocator<Http3HeadersFrame> http3HeadersFrameAllocator;
extern ClassAllocator<Http3SettingsFrame> http3SettingsFrameAllocator;
extern ClassAllocator<Http3Frame, false> http3FrameAllocator;
extern ClassAllocator<Http3DataFrame, false> http3DataFrameAllocator;
extern ClassAllocator<Http3HeadersFrame, false> http3HeadersFrameAllocator;
extern ClassAllocator<Http3SettingsFrame, false> http3SettingsFrameAllocator;

class Http3FrameDeleter
{
Expand Down
10 changes: 6 additions & 4 deletions include/tscore/Allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#pragma once

#include <concepts>
#include <cstdlib>
#include <utility>
#include "tscore/ink_queue.h"
Expand Down Expand Up @@ -329,7 +330,8 @@ using Allocator = FreelistAllocator;
Allocator for Class objects.

*/
template <class C, bool Destruct_on_free_ = false, typename BaseAllocator = Allocator> class ClassAllocator : public BaseAllocator
template <std::destructible C, bool Destruct_on_free_ = true, typename BaseAllocator = Allocator>
class ClassAllocator : public BaseAllocator
{
public:
using Value_type = C;
Expand Down Expand Up @@ -380,8 +382,8 @@ template <class C, bool Destruct_on_free_ = false, typename BaseAllocator = Allo
void
destroy_if_enabled(C *ptr)
{
if (Destruct_on_free) {
ptr->~C();
if constexpr (Destruct_on_free) {
std::destroy_at(ptr);
}
}

Expand All @@ -390,7 +392,7 @@ template <class C, bool Destruct_on_free_ = false, typename BaseAllocator = Allo
static_assert(sizeof(C) >= sizeof(void *), "Can not allocate instances of this class using ClassAllocator");
};

template <class C, bool Destruct_on_free = false> class TrackerClassAllocator : public ClassAllocator<C, Destruct_on_free>
template <class C, bool Destruct_on_free = true> class TrackerClassAllocator : public ClassAllocator<C, Destruct_on_free>
{
public:
TrackerClassAllocator(const char *name, unsigned int chunk_size = 128, unsigned int alignment = 16)
Expand Down
2 changes: 1 addition & 1 deletion plugins/experimental/memcache/tsmemcache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define REALTIME_MAXDELTA 60 * 60 * 24 * 30
#define STRCMP_REST(_c, _s, _e) (((_e) - (_s)) < (int)sizeof(_c) || STRCMP(_s, _c) || !isspace((_s)[sizeof(_c) - 1]))

ClassAllocator<MC> theMCAllocator("MC");
ClassAllocator<MC, false> theMCAllocator("MC");

static time_t base_day_time;

Expand Down
2 changes: 1 addition & 1 deletion plugins/header_rewrite/matcher_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ TSHttpTxnServerRespGet(TSHttpTxn, TSMBuffer *, TSMLoc *)
return TS_SUCCESS;
}

ClassAllocator<ProxyMutex> mutexAllocator("mutexAllocator");
ClassAllocator<ProxyMutex, false> mutexAllocator("mutexAllocator");

TEST_CASE("Matcher", "[plugins][header_rewrite]")
{
Expand Down
2 changes: 1 addition & 1 deletion src/api/APIHooks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "iocore/eventsystem/ProxyAllocator.h"
#include "iocore/eventsystem/Thread.h"

static ClassAllocator<APIHook> apiHookAllocator("apiHookAllocator");
static ClassAllocator<APIHook, false> apiHookAllocator("apiHookAllocator");

APIHook *
APIHooks::head() const
Expand Down
14 changes: 7 additions & 7 deletions src/api/InkAPI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static ts::Metrics &global_api_metrics = ts::Metrics::instance();
ConfigUpdateCbTable *global_config_cbs = nullptr;

// Fetchpages SM
extern ClassAllocator<FetchSM> FetchSMAllocator;
extern ClassAllocator<FetchSM, false> FetchSMAllocator;

/* From proxy/http/HttpProxyServerMain.c: */
extern bool ssl_register_protocol(const char *, Continuation *);
Expand All @@ -139,12 +139,12 @@ extern SSLSessionCache *session_cache; // declared extern in P_SSLConfig.h
// External converters.
extern MgmtConverter const &HttpDownServerCacheTimeConv;

extern HttpSessionAccept *plugin_http_accept;
extern HttpSessionAccept *plugin_http_transparent_accept;
extern thread_local PluginThreadContext *pluginThreadContext;
extern ClassAllocator<INKContInternal> INKContAllocator;
extern ClassAllocator<INKVConnInternal> INKVConnAllocator;
static ClassAllocator<MIMEFieldSDKHandle> mHandleAllocator("MIMEFieldSDKHandle");
extern HttpSessionAccept *plugin_http_accept;
extern HttpSessionAccept *plugin_http_transparent_accept;
extern thread_local PluginThreadContext *pluginThreadContext;
extern ClassAllocator<INKContInternal, false> INKContAllocator;
extern ClassAllocator<INKVConnInternal, false> INKVConnAllocator;
static ClassAllocator<MIMEFieldSDKHandle, false> mHandleAllocator("MIMEFieldSDKHandle");

// forward declarations
TSReturnCode sdk_sanity_check_null_ptr(void const *ptr);
Expand Down
2 changes: 1 addition & 1 deletion src/api/InkAPITest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8831,7 +8831,7 @@ std::array<std::string_view, TS_CONFIG_LAST_ENTRY> SDK_Overridable_Configs = {
};
// clang-format on

extern ClassAllocator<HttpSM> httpSMAllocator;
extern ClassAllocator<HttpSM, false> httpSMAllocator;

REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
{
Expand Down
2 changes: 1 addition & 1 deletion src/api/InkContInternal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "iocore/eventsystem/ProxyAllocator.h"
#include "iocore/eventsystem/VConnection.h"

ClassAllocator<INKContInternal> INKContAllocator("INKContAllocator");
ClassAllocator<INKContInternal, false> INKContAllocator("INKContAllocator");

namespace
{
Expand Down
2 changes: 1 addition & 1 deletion src/api/InkVConnInternal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "ts/apidefs.h"
#include "ts/InkAPIPrivateIOCore.h"

ClassAllocator<INKVConnInternal> INKVConnAllocator("INKVConnAllocator");
ClassAllocator<INKVConnInternal, false> INKVConnAllocator("INKVConnAllocator");

INKVConnInternal::INKVConnInternal() : INKContInternal(), m_read_vio(), m_write_vio(), m_output_vc(nullptr)
{
Expand Down
2 changes: 1 addition & 1 deletion src/cripts/Context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "cripts/Context.hpp"

// Freelist management. These are here to avoid polluting the Context includes with ATS core includes.
ClassAllocator<cripts::Context> criptContextAllocator("cripts::Context");
ClassAllocator<cripts::Context, false> criptContextAllocator("cripts::Context");

namespace cripts
{
Expand Down
30 changes: 15 additions & 15 deletions src/iocore/cache/Cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,21 @@ int cache_config_persist_bad_disks = false;

// Globals

CacheStatsBlock cache_rsb;
Cache *theCache = nullptr;
std::vector<std::unique_ptr<CacheDisk>> gdisks;
int gndisks = 0;
Cache *caches[NUM_CACHE_FRAG_TYPES] = {nullptr};
CacheSync *cacheDirSync = nullptr;
Store theCacheStore;
StripeSM **gstripes = nullptr;
std::atomic<int> gnstripes = 0;
ClassAllocator<CacheVC> cacheVConnectionAllocator("cacheVConnection");
ClassAllocator<CacheEvacuateDocVC> cacheEvacuateDocVConnectionAllocator("cacheEvacuateDocVC");
ClassAllocator<EvacuationBlock> evacuationBlockAllocator("evacuationBlock");
ClassAllocator<CacheRemoveCont> cacheRemoveContAllocator("cacheRemoveCont");
ClassAllocator<EvacuationKey> evacuationKeyAllocator("evacuationKey");
std::unordered_set<std::string> known_bad_disks;
CacheStatsBlock cache_rsb;
Cache *theCache = nullptr;
std::vector<std::unique_ptr<CacheDisk>> gdisks;
int gndisks = 0;
Cache *caches[NUM_CACHE_FRAG_TYPES] = {nullptr};
CacheSync *cacheDirSync = nullptr;
Store theCacheStore;
StripeSM **gstripes = nullptr;
std::atomic<int> gnstripes = 0;
ClassAllocator<CacheVC, false> cacheVConnectionAllocator("cacheVConnection");
ClassAllocator<CacheEvacuateDocVC, false> cacheEvacuateDocVConnectionAllocator("cacheEvacuateDocVC");
ClassAllocator<EvacuationBlock, false> evacuationBlockAllocator("evacuationBlock");
ClassAllocator<CacheRemoveCont, false> cacheRemoveContAllocator("cacheRemoveCont");
ClassAllocator<EvacuationKey, false> evacuationKeyAllocator("evacuationKey");
std::unordered_set<std::string> known_bad_disks;

namespace
{
Expand Down
2 changes: 1 addition & 1 deletion src/iocore/cache/CacheDir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ DbgCtl dbg_ctl_dir_lookaside{"dir_lookaside"};

// Globals

ClassAllocator<OpenDirEntry> openDirEntryAllocator("openDirEntry");
ClassAllocator<OpenDirEntry, false> openDirEntryAllocator("openDirEntry");

// OpenDir

Expand Down
2 changes: 1 addition & 1 deletion src/iocore/cache/CacheEvacuateDocVC.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CacheEvacuateDocVC : public CacheVC
int evacuateReadHead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */);
};

extern ClassAllocator<CacheEvacuateDocVC> cacheEvacuateDocVConnectionAllocator;
extern ClassAllocator<CacheEvacuateDocVC, false> cacheEvacuateDocVConnectionAllocator;

inline CacheEvacuateDocVC *
new_CacheEvacuateDocVC(Continuation *cont)
Expand Down
8 changes: 4 additions & 4 deletions src/iocore/cache/P_CacheInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ struct CacheRemoveCont : public Continuation {
};

// Global Data
extern ClassAllocator<CacheVC> cacheVConnectionAllocator;
extern ClassAllocator<CacheEvacuateDocVC> cacheEvacuateDocVConnectionAllocator;
extern CacheSync *cacheDirSync;
extern ClassAllocator<CacheVC, false> cacheVConnectionAllocator;
extern ClassAllocator<CacheEvacuateDocVC, false> cacheEvacuateDocVConnectionAllocator;
extern CacheSync *cacheDirSync;
// Function Prototypes
int cache_write(CacheVC *, CacheHTTPInfoVector *);
int get_alternate_index(CacheHTTPInfoVector *cache_vector, CacheKey key);
Expand Down Expand Up @@ -411,7 +411,7 @@ next_rand(unsigned int *p)
return seed;
}

extern ClassAllocator<CacheRemoveCont> cacheRemoveContAllocator;
extern ClassAllocator<CacheRemoveCont, false> cacheRemoveContAllocator;

inline CacheRemoveCont *
new_CacheRemoveCont()
Expand Down
4 changes: 2 additions & 2 deletions src/iocore/cache/PreservationTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ PreservationTable::evac_bucket_valid(off_t bucket) const
return (bucket >= 0 && bucket < evacuate_size);
}

extern ClassAllocator<EvacuationBlock> evacuationBlockAllocator;
extern ClassAllocator<EvacuationKey> evacuationKeyAllocator;
extern ClassAllocator<EvacuationBlock, false> evacuationBlockAllocator;
extern ClassAllocator<EvacuationKey, false> evacuationKeyAllocator;

inline EvacuationBlock *
new_EvacuationBlock()
Expand Down
2 changes: 1 addition & 1 deletion src/iocore/cache/RamCacheCLFUS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ RamCacheCLFUSCompressor::mainEvent(int /* event ATS_UNUSED */, Event *e)
return EVENT_CONT;
}

ClassAllocator<RamCacheCLFUSEntry> ramCacheCLFUSEntryAllocator("RamCacheCLFUSEntry");
ClassAllocator<RamCacheCLFUSEntry, false> ramCacheCLFUSEntryAllocator("RamCacheCLFUSEntry");

static const int bucket_sizes[] = {127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749,
65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593, 16777213,
Expand Down
2 changes: 1 addition & 1 deletion src/iocore/cache/RamCacheLRU.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ RamCacheLRU::size() const
return s;
}

ClassAllocator<RamCacheLRUEntry> ramCacheLRUEntryAllocator("RamCacheLRUEntry");
ClassAllocator<RamCacheLRUEntry, false> ramCacheLRUEntryAllocator("RamCacheLRUEntry");

static const int bucket_sizes[] = {8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143,
4194301, 8388593, 16777213, 33554393, 67108859, 134217689, 268435399, 536870909, 1073741827};
Expand Down
Loading