From caab73699bc789d99183e3af596ef8eaea8b5769 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 26 Nov 2015 02:02:28 -0800 Subject: [PATCH] CYPool's reservation policy was a stub/mistake :/. --- Pooling.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Pooling.hpp b/Pooling.hpp index 6225392..c03dd1d 100644 --- a/Pooling.hpp +++ b/Pooling.hpp @@ -43,6 +43,7 @@ class CYPool { private: uint8_t *data_; size_t size_; + size_t next_; struct Cleaner { Cleaner *next_; @@ -70,9 +71,10 @@ class CYPool { CYPool(const CYPool &); public: - CYPool() : + CYPool(size_t next = 64) : data_(NULL), size_(0), + next_(next), cleaner_(NULL) { } @@ -90,8 +92,8 @@ class CYPool { size = align(size); if (size > size_) { - // XXX: is this an optimal malloc size? - size_ = std::max(size, size + align(sizeof(Cleaner))); + size_ = std::max(next_, size + align(sizeof(Cleaner))); + next_ *= 2; data_ = reinterpret_cast(::malloc(size_)); atexit(free, data_); _assert(size <= size_); -- 2.45.2