MCPcopy Create free account
hub / github.com/apache/trafficserver / alloc

Method alloc

src/tscore/Arena.cc:94–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94void *
95Arena::alloc(size_t size, size_t alignment)
96{
97 ArenaBlock *b;
98 unsigned int block_size;
99 void *mem;
100
101 ink_assert((alignment & (alignment - 1)) == 0);
102
103 b = m_blocks;
104 while (b) {
105 mem = block_alloc(b, size, alignment);
106 if (mem) {
107 return mem;
108 }
109 b = b->next;
110 }
111
112 block_size = static_cast<unsigned int>(size * 1.5);
113 if (block_size < DEFAULT_BLOCK_SIZE) {
114 block_size = DEFAULT_BLOCK_SIZE;
115 }
116
117 b = blk_alloc(block_size);
118 b->next = m_blocks;
119 m_blocks = b;
120
121 mem = block_alloc(b, size, alignment);
122 return mem;
123}
124
125/*-------------------------------------------------------------------------
126 -------------------------------------------------------------------------*/

Callers 10

toIndexMethod · 0.45
test_Allocator.ccFile · 0.45
test_arena.ccFile · 0.45
TSHttpTxnCachedReqGetFunction · 0.45
TSHttpTxnCachedRespGetFunction · 0.45
TSHostLookupFunction · 0.45
TSFetchPagesFunction · 0.45
TSFetchUrlFunction · 0.45
TSFetchCreateFunction · 0.45
new_SocksProxyFunction · 0.45

Calls 2

block_allocFunction · 0.85
blk_allocFunction · 0.85

Tested by

no test coverage detected