New MemoryPool tool
This commit is contained in:
parent
7bd2ccbee4
commit
59de27a696
3 changed files with 115 additions and 0 deletions
|
@ -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
19
sample/testPool.cpp
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue