diff --git a/src/common/memory.h b/src/common/memory.h index b191449b..1fda60f9 100644 --- a/src/common/memory.h +++ b/src/common/memory.h @@ -35,6 +35,8 @@ #include #include +#include + #ifdef __APPLE__ #define sys_mmap mmap #define sys_mmap2 mmap @@ -159,7 +161,7 @@ class wasteful_vector { void push_back(const T& new_element) { if (used_ == allocated_) - Realloc(allocated_ * 2); + Realloc(std::max(allocated_ * 2, 1u)); a_[used_++] = new_element; }