Skip to content

Commit e6a7603

Browse files
authored
Make the rest of InkAPI allocators Proxy Allocated (#8106)
* Make the rest of InkAPI allocators Proxy Allocated * As per Walt the all-knowing oracle, remove from test
1 parent 84cf02e commit e6a7603

File tree

3 files changed

+10
-33
lines changed

3 files changed

+10
-33
lines changed

iocore/eventsystem/I_Thread.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ class Thread
135135
ProxyAllocator ioDataAllocator;
136136
ProxyAllocator ioAllocator;
137137
ProxyAllocator ioBlockAllocator;
138+
// From InkAPI (plugins wrappers)
139+
ProxyAllocator apiHookAllocator;
140+
ProxyAllocator INKContAllocator;
141+
ProxyAllocator INKVConnAllocator;
138142
ProxyAllocator mHandleAllocator;
139143

140144
/** Start the underlying thread.

src/traffic_server/InkAPI.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ INKContInternal::free()
10751075
clear();
10761076
this->mutex.clear();
10771077
m_free_magic = INKCONT_INTERN_MAGIC_DEAD;
1078-
INKContAllocator.free(this);
1078+
THREAD_FREE(this, INKContAllocator, this_thread());
10791079
}
10801080

10811081
void
@@ -1181,7 +1181,7 @@ INKVConnInternal::free()
11811181
clear();
11821182
this->mutex.clear();
11831183
m_free_magic = INKCONT_INTERN_MAGIC_DEAD;
1184-
INKVConnAllocator.free(this);
1184+
THREAD_FREE(this, INKVConnAllocator, this_thread());
11851185
}
11861186

11871187
void
@@ -1386,7 +1386,7 @@ APIHooks::append(INKContInternal *cont)
13861386
{
13871387
APIHook *api_hook;
13881388

1389-
api_hook = apiHookAllocator.alloc();
1389+
api_hook = THREAD_ALLOC(apiHookAllocator, this_thread());
13901390
api_hook->m_cont = cont;
13911391

13921392
m_hooks.enqueue(api_hook);
@@ -1397,7 +1397,7 @@ APIHooks::clear()
13971397
{
13981398
APIHook *hook;
13991399
while (nullptr != (hook = m_hooks.pop())) {
1400-
apiHookAllocator.free(hook);
1400+
THREAD_FREE(hook, apiHookAllocator, this_thread());
14011401
}
14021402
}
14031403

@@ -4599,7 +4599,7 @@ TSContCreate(TSEventFunc funcp, TSMutex mutexp)
45994599
pluginThreadContext->acquire();
46004600
}
46014601

4602-
INKContInternal *i = INKContAllocator.alloc();
4602+
INKContInternal *i = THREAD_ALLOC(INKContAllocator, this_thread());
46034603

46044604
i->init(funcp, mutexp, pluginThreadContext);
46054605
return (TSCont)i;
@@ -7002,7 +7002,7 @@ TSVConnCreate(TSEventFunc event_funcp, TSMutex mutexp)
70027002
pluginThreadContext->acquire();
70037003
}
70047004

7005-
INKVConnInternal *i = INKVConnAllocator.alloc();
7005+
INKVConnInternal *i = THREAD_ALLOC(INKVConnAllocator, this_thread());
70067006

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

tests/tools/plugins/test_hooks.cc

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -344,30 +344,3 @@ TSPluginInit(int argc, const char *argv[])
344344

345345
tCont = TSContCreate(transactionContFunc, mtx);
346346
}
347-
348-
namespace
349-
{
350-
class Cleanup
351-
{
352-
public:
353-
~Cleanup()
354-
{
355-
// In practice it is not strictly necessary to destroy remaining continuations on program exit.
356-
357-
if (tCont) {
358-
TSContDestroy(tCont);
359-
}
360-
if (sCont) {
361-
TSContDestroy(sCont);
362-
}
363-
if (gCont) {
364-
TSContDestroy(gCont);
365-
}
366-
}
367-
};
368-
369-
// Do any needed cleanup for this source file at program termination time.
370-
//
371-
Cleanup cleanup;
372-
373-
} // namespace

0 commit comments

Comments
 (0)