Compare commits

...

2 Commits

3 changed files with 8 additions and 1 deletions

View File

@ -3,6 +3,9 @@ project(allocPool)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
add_executable(allocPool main.cpp add_executable(allocPool main.cpp
allocPool.hpp allocPool.hpp
tests.cpp tests.cpp

View File

@ -24,6 +24,11 @@ public:
initArray(defaultAllocNumbers); initArray(defaultAllocNumbers);
} }
~allocPool() {
for (auto i: vec)
delete i;
}
T *getPtr() { T *getPtr() {
if (pivot == 0) if (pivot == 0)
resizeVec(); resizeVec();

View File

@ -34,6 +34,5 @@ int main() {
std::cout << "Time (milliseconds) required for real allocations when constructing pool: " << std::cout << "Time (milliseconds) required for real allocations when constructing pool: " <<
std::chrono::duration_cast<std::chrono::milliseconds>(endAlloc - startAlloc).count() << "\n"; std::chrono::duration_cast<std::chrono::milliseconds>(endAlloc - startAlloc).count() << "\n";
return 0; return 0;
} }