allocPool: Add destructor which cleans up.
This commit is contained in:
parent
6cd26d5ee9
commit
9f68be78db
@ -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();
|
||||||
|
1
main.cpp
1
main.cpp
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user