void automatic memory recovery

This commit is contained in:
mutouyun 2019-10-07 12:18:26 +00:00
parent f3eb6ba55a
commit 1fd8e27994
2 changed files with 8 additions and 8 deletions

View File

@ -69,8 +69,8 @@ public:
master_allocs_.emplace(std::move(alc)); master_allocs_.emplace(std::move(alc));
} }
else const_cast<alloc_policy&>(*it).swap(alc); else const_cast<alloc_policy&>(*it).swap(alc);
if (master_allocs_.size() <= 32) return; // if (master_allocs_.size() <= 32) return;
take_first_do([](alloc_policy &) {}); // erase first // take_first_do([](alloc_policy &) {}); // erase first
} }
constexpr static auto try_replenish(alloc_policy&, std::size_t) noexcept {} constexpr static auto try_replenish(alloc_policy&, std::size_t) noexcept {}

View File

@ -33,13 +33,13 @@ private slots:
#include "test_mem.moc" #include "test_mem.moc"
// constexpr int DataMin = 4; constexpr int DataMin = 4;
// constexpr int DataMax = 256; constexpr int DataMax = 256;
// constexpr int LoopCount = 4194304; constexpr int LoopCount = 4194304;
constexpr int DataMin = 256; // constexpr int DataMin = 256;
constexpr int DataMax = 512; // constexpr int DataMax = 512;
constexpr int LoopCount = 2097152; // constexpr int LoopCount = 2097152;
std::vector<std::size_t> sizes__; std::vector<std::size_t> sizes__;