Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the rest of InkAPI allocators Proxy Allocated #8106

Merged
merged 2 commits into from
Jul 28, 2021
Merged
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
4 changes: 4 additions & 0 deletions iocore/eventsystem/I_Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ class Thread
ProxyAllocator ioDataAllocator;
ProxyAllocator ioAllocator;
ProxyAllocator ioBlockAllocator;
// From InkAPI (plugins wrappers)
ProxyAllocator apiHookAllocator;
ProxyAllocator INKContAllocator;
ProxyAllocator INKVConnAllocator;
ProxyAllocator mHandleAllocator;

/** Start the underlying thread.
Expand Down
12 changes: 6 additions & 6 deletions src/traffic_server/InkAPI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ INKContInternal::free()
clear();
this->mutex.clear();
m_free_magic = INKCONT_INTERN_MAGIC_DEAD;
INKContAllocator.free(this);
THREAD_FREE(this, INKContAllocator, this_thread());
}

void
Expand Down Expand Up @@ -1181,7 +1181,7 @@ INKVConnInternal::free()
clear();
this->mutex.clear();
m_free_magic = INKCONT_INTERN_MAGIC_DEAD;
INKVConnAllocator.free(this);
THREAD_FREE(this, INKVConnAllocator, this_thread());
}

void
Expand Down Expand Up @@ -1386,7 +1386,7 @@ APIHooks::append(INKContInternal *cont)
{
APIHook *api_hook;

api_hook = apiHookAllocator.alloc();
api_hook = THREAD_ALLOC(apiHookAllocator, this_thread());
api_hook->m_cont = cont;

m_hooks.enqueue(api_hook);
Expand All @@ -1397,7 +1397,7 @@ APIHooks::clear()
{
APIHook *hook;
while (nullptr != (hook = m_hooks.pop())) {
apiHookAllocator.free(hook);
THREAD_FREE(hook, apiHookAllocator, this_thread());
}
}

Expand Down Expand Up @@ -4599,7 +4599,7 @@ TSContCreate(TSEventFunc funcp, TSMutex mutexp)
pluginThreadContext->acquire();
}

INKContInternal *i = INKContAllocator.alloc();
INKContInternal *i = THREAD_ALLOC(INKContAllocator, this_thread());

i->init(funcp, mutexp, pluginThreadContext);
return (TSCont)i;
Expand Down Expand Up @@ -7002,7 +7002,7 @@ TSVConnCreate(TSEventFunc event_funcp, TSMutex mutexp)
pluginThreadContext->acquire();
}

INKVConnInternal *i = INKVConnAllocator.alloc();
INKVConnInternal *i = THREAD_ALLOC(INKVConnAllocator, this_thread());

sdk_assert(sdk_sanity_check_null_ptr((void *)i) == TS_SUCCESS);

Expand Down
27 changes: 0 additions & 27 deletions tests/tools/plugins/test_hooks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -344,30 +344,3 @@ TSPluginInit(int argc, const char *argv[])

tCont = TSContCreate(transactionContFunc, mtx);
}

namespace
{
class Cleanup
{
public:
~Cleanup()
{
// In practice it is not strictly necessary to destroy remaining continuations on program exit.

if (tCont) {
TSContDestroy(tCont);
}
if (sCont) {
TSContDestroy(sCont);
}
if (gCont) {
TSContDestroy(gCont);
}
}
};

// Do any needed cleanup for this source file at program termination time.
//
Cleanup cleanup;

} // namespace