New MemoryPool tool

This commit is contained in:
Guilhem Lavaux 2012-05-18 18:16:13 -04:00
parent 7bd2ccbee4
commit 59de27a696
3 changed files with 115 additions and 0 deletions

View file

@ -22,6 +22,9 @@ target_link_libraries(testDelaunay ${tolink})
add_executable(testNewton testNewton.cpp)
target_link_libraries(testNewton ${tolink})
add_executable(testPool testPool.cpp)
target_link_libraries(testPool ${tolink})
if (HDF5_FOUND)
add_executable(testReadFlash testReadFlash.cpp)
target_link_libraries(testReadFlash ${tolink})

19
sample/testPool.cpp Normal file
View file

@ -0,0 +1,19 @@
#include "pool.hpp"
using namespace CosmoTool;
int main(int argc, char **argv)
{
MemoryPool<int> pool(1024);
int **j = new int *[3000];
for (int i = 0; i < 3000; i++)
{
j[i] = pool.alloc();
j[i][0] = i;
}
pool.free_all();
return 0;
}