aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/memory.h4
1 files changed, 3 insertions, 1 deletions
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 <unistd.h>
#include <sys/mman.h>
+#include <algorithm>
+
#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;
}