From 71fff8ffa2fa80a34d2b3bf3f705ef0852310b04 Mon Sep 17 00:00:00 2001 From: Nikolaj Bjorner Date: Wed, 9 Mar 2016 00:42:50 -0800 Subject: [PATCH] fix boundary case according to analysis #477, e.g., size = 252, PTR_ALIGNMENT=2, slot_id = 64 = NUM_SLOTS Signed-off-by: Nikolaj Bjorner --- src/util/small_object_allocator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/small_object_allocator.cpp b/src/util/small_object_allocator.cpp index edc3885cd..6ad1af112 100644 --- a/src/util/small_object_allocator.cpp +++ b/src/util/small_object_allocator.cpp @@ -77,7 +77,7 @@ void small_object_allocator::deallocate(size_t size, void * p) { SASSERT(m_alloc_size >= size); SASSERT(p); m_alloc_size -= size; - if (size > SMALL_OBJ_SIZE - (1 << PTR_ALIGNMENT)) { + if (size >= SMALL_OBJ_SIZE - (1 << PTR_ALIGNMENT)) { memory::deallocate(p); return; } @@ -96,7 +96,7 @@ void * small_object_allocator::allocate(size_t size) { return memory::allocate(size); #endif m_alloc_size += size; - if (size > SMALL_OBJ_SIZE - (1 << PTR_ALIGNMENT)) + if (size >= SMALL_OBJ_SIZE - (1 << PTR_ALIGNMENT)) return memory::allocate(size); #ifdef Z3DEBUG size_t osize = size;