Lines Matching refs:pool
98 rml::MemoryPool *pool; in TestPoolReset() local
100 pool_create_v1(0, &pol, &pool); in TestPoolReset()
102 REQUIRE(pool_malloc(pool, 8)); in TestPoolReset()
103 REQUIRE(pool_malloc(pool, 50*1024)); in TestPoolReset()
106 bool ok = pool_reset(pool); in TestPoolReset()
109 REQUIRE(pool_malloc(pool, 8)); in TestPoolReset()
110 REQUIRE(pool_malloc(pool, 50*1024)); in TestPoolReset()
114 ok = pool_destroy(pool); in TestPoolReset()
123 static rml::MemoryPool *pool; member in SharedPoolRun
131 pool = pl; in init()
144 afterTerm[i] = pool_malloc(pool, i%2? 8*1024 : 9*1024); in operator ()()
146 crossThread[i] = pool_malloc(pool, i%2? 9*1024 : 8*1024); in operator ()()
151 local[i-1] = pool_malloc(pool, 6*1024); in operator ()()
153 local[i] = pool_malloc(pool, 16*1024); in operator ()()
159 pool_free(pool, crossThread[i]); in operator ()()
161 pool_free(pool, local[i]); in operator ()()
168 rml::MemoryPool *SharedPoolRun::pool; member in SharedPoolRun
176 rml::MemoryPool *pool; in TestSharedPool() local
178 pool_create_v1(0, &pol, &pool); in TestSharedPool()
183 SharedPoolRun::init(p, pool, crossThread, afterTerm); in TestSharedPool()
186 void *hugeObj = pool_malloc(pool, 10*1024*1024); in TestSharedPool()
191 pool_free(pool, hugeObj); in TestSharedPool()
193 pool_free(pool, afterTerm[i]); in TestSharedPool()
198 bool ok = pool_destroy(pool); in TestSharedPool()
224 static rml::MemoryPool **pool; member in CrossThreadRun
230 pool = new rml::MemoryPool*[number_of_threads]; in init()
237 delete []pool; in destroy()
246 pool_create_v1(id, &pol, &pool[id]); in operator ()()
247 obj[id] = (char*)pool_malloc(pool[id], objLen); in operator ()()
253 void *ptrLarge = pool_malloc(pool[id], lrgSz); in operator ()()
257 while (pool_malloc(pool[id], 5 * 1024)); in operator ()()
260 pool_free(pool[id], ptrLarge); in operator ()()
261 CHECK(!pool_malloc(pool[id], 5*1024)); in operator ()()
268 pool_free(pool[myPool], obj[myPool]); in operator ()()
269 bool ok = pool_destroy(pool[myPool]); in operator ()()
276 rml::MemoryPool **CrossThreadRun::pool; member in CrossThreadRun
298 rml::MemoryPool *pool; in TestTooSmallBuffer() local
299 pool_create_v1(0, &pol, &pool); in TestTooSmallBuffer()
300 bool ok = pool_destroy(pool); in TestTooSmallBuffer()
339 rml::MemoryPool *pool; member in FixedPoolUse
344 pool(p), reqSize(sz), iters(it) { in FixedPoolUse()
350 void *o = pool_malloc(pool, reqSize); in operator ()()
352 pool_free(pool, o); in operator ()()
361 rml::MemoryPool *pool; member in FixedPoolNomem
364 startB(b), pool(p) {} in FixedPoolNomem()
367 void *o = pool_malloc(pool, id%2? 64 : 128*1024); in operator ()()
374 rml::MemoryPool *pool; member in FixedPoolSomeMem
377 barrier(b), pool(p) {} in FixedPoolSomeMem()
381 void *o = pool_malloc(pool, id%2? 64 : 128*1024); in operator ()()
383 pool_free(pool, o); in operator ()()
387 bool haveEnoughSpace(rml::MemoryPool *pool, size_t sz) in haveEnoughSpace() argument
389 if (void *p = pool_malloc(pool, sz)) { in haveEnoughSpace()
390 pool_free(pool, p); in haveEnoughSpace()
403 rml::MemoryPool *pool; in TestFixedBufferPool() local
407 pool_create_v1((intptr_t)&head, &pol, &pool); in TestFixedBufferPool()
409 utils::NativeParallelFor( 1, FixedPoolUse(1, pool, MAX_OBJECT, 2) ); in TestFixedBufferPool()
412 ptrs[i] = pool_malloc(pool, MAX_OBJECT/ITERS); in TestFixedBufferPool()
416 pool_free(pool, ptrs[i]); in TestFixedBufferPool()
418 utils::NativeParallelFor( 1, FixedPoolUse(1, pool, MAX_OBJECT, 1) ); in TestFixedBufferPool()
423 utils::NativeParallelFor( p, FixedPoolUse(p, pool, MAX_OBJECT/p/2, 10000) ); in TestFixedBufferPool()
427 utils::NativeParallelFor( p, FixedPoolUse(p, pool, MAX_OBJECT/p/2, 1) ); in TestFixedBufferPool()
438 REQUIRE(haveEnoughSpace(pool, MAX_OBJECT/2)); in TestFixedBufferPool()
441 if (haveEnoughSpace(pool, mid)) in TestFixedBufferPool()
447 REQUIRE_MESSAGE(!haveEnoughSpace(pool, maxSz+1), "Expect to find boundary value."); in TestFixedBufferPool()
449 void *largeObj = pool_malloc(pool, maxSz); in TestFixedBufferPool()
451 void *o = pool_malloc(pool, 64); in TestFixedBufferPool()
453 pool_free(pool, o); in TestFixedBufferPool()
455 utils::NativeParallelFor( p, FixedPoolNomem(&barrier, pool) ); in TestFixedBufferPool()
456 pool_free(pool, largeObj); in TestFixedBufferPool()
458 largeObj = pool_malloc(pool, maxSz-512*1024); in TestFixedBufferPool()
460 utils::NativeParallelFor( p, FixedPoolSomeMem(&barrier, pool) ); in TestFixedBufferPool()
461 pool_free(pool, largeObj); in TestFixedBufferPool()
463 bool ok = pool_destroy(pool); in TestFixedBufferPool()
469 pool_create_v1((intptr_t)&head, &pol, &pool); in TestFixedBufferPool()
471 utils::NativeParallelFor( p, FixedPoolUse(p, pool, MAX_OBJECT/p/2, 1) ); in TestFixedBufferPool()
472 bool ok = pool_destroy(pool); in TestFixedBufferPool()
499 rml::MemoryPool *pool; in TestPoolGranularity() local
501 pool_create_v1(0, &pol, &pool); in TestPoolGranularity()
503 void *p = pool_malloc(pool, sz); in TestPoolGranularity()
505 pool_free(pool, p); in TestPoolGranularity()
507 bool ok = pool_destroy(pool); in TestPoolGranularity()
535 rml::MemoryPool *pool; in TestPoolKeepTillDestroy() local
543 pool_create_v1(0, &pol, &pool); in TestPoolKeepTillDestroy()
545 ptrs[i] = pool_malloc(pool, 7*1024); in TestPoolKeepTillDestroy()
546 ptrs[i+1] = pool_malloc(pool, 10*1024); in TestPoolKeepTillDestroy()
548 ptrs[2*ITERS] = pool_malloc(pool, 8*1024*1024); in TestPoolKeepTillDestroy()
551 pool_free(pool, ptrs[i]); in TestPoolKeepTillDestroy()
552 pool_free(pool, ptrs[2*ITERS]); in TestPoolKeepTillDestroy()
561 void *p = pool_malloc(pool, 8*1024*1024); in TestPoolKeepTillDestroy()
566 bool ok = pool_reset(pool); in TestPoolKeepTillDestroy()
569 ok = pool_destroy(pool); in TestPoolKeepTillDestroy()
596 rml::MemoryPool *pool; in TestEntries() local
598 pool_create_v1(0, &pol, &pool); in TestEntries()
601 char *p = (char*)pool_aligned_malloc(pool, size[i], algn[j]); in TestEntries()
607 char *p1 = (char*)pool_aligned_realloc(pool, p, curr_sz, curr_algn); in TestEntries()
613 char *p2 = (char*)pool_realloc(pool, p1, curr_sz1); in TestEntries()
617 pool_free(pool, p2); in TestEntries()
620 bool ok = pool_destroy(pool); in TestEntries()
631 rml::MemoryPool *pool; in CreateUsablePool() local
635 rml::MemPoolError res = pool_create_v1(0, &okPolicy, &pool); in CreateUsablePool()
640 void *o = pool_malloc(pool, size); in CreateUsablePool()
650 pool_free(pool, o); in CreateUsablePool()
652 return pool; in CreateUsablePool()
694 rml::MemoryPool *pool; in TestPoolCreation() local
696 rml::MemPoolError res = pool_create_v1(0, &nullPolicy, &pool); in TestPoolCreation()
698 res = pool_create_v1(0, &emptyFreePolicy, &pool); in TestPoolCreation()
701 res = pool_create_v1(0, &okPolicy, &pool); in TestPoolCreation()
703 bool ok = pool_destroy(pool); in TestPoolCreation()
716 rml::MemoryPool *pool; member
744 objs[id]->pool = act_pool; in operator ()()
770 REQUIRE(p == objs[i]->pool); in TestPoolDetection()
786 rml::MemoryPool *pool = CreateUsablePool(sizes[i]); in TestLazyBootstrap() local
787 bool ok = pool_destroy(pool); in TestLazyBootstrap()
794 rml::MemoryPool *pool; member in NoLeakOnDestroyRun
797 NoLeakOnDestroyRun(rml::MemoryPool *p, utils::SpinBarrier *b) : pool(p), barrier(b) {} in NoLeakOnDestroyRun()
799 void *p = pool_malloc(pool, id%2? 8 : 9000); in operator ()()
803 bool ok = pool_destroy(pool); in operator ()()
819 rml::MemoryPool *pool; in TestNoLeakOnDestroy() local
821 pool_create_v1(0, &pol, &pool); in TestNoLeakOnDestroy()
822 utils::NativeParallelFor(p, NoLeakOnDestroyRun(pool, &barrier)); in TestNoLeakOnDestroy()
840 rml::MemoryPool *pool; in TestDestroyFailed() local
841 pool_create_v1(0, &pol, &pool); in TestDestroyFailed()
842 void *ptr = pool_malloc(pool, 16); in TestDestroyFailed()
844 bool fail = pool_destroy(pool); in TestDestroyFailed()
850 rml::MemoryPool *pool = CreateUsablePool(1024); in TestPoolMSize() local
865 void* obj = pool_malloc(pool, requestedSz[i]); in TestPoolMSize()
866 size_t objSize = pool_msize(pool, obj); in TestPoolMSize()
868 pool_free(pool, obj); in TestPoolMSize()
870 bool destroyed = pool_destroy(pool); in TestPoolMSize()