summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/util/mempool.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/util/mempool.c b/lib/util/mempool.c
index dd2d692..57aab4d 100644
--- a/lib/util/mempool.c
+++ b/lib/util/mempool.c
@@ -14,6 +14,7 @@
#include <sys/mman.h>
#define DEF_POOL_SIZE (65536)
+#define MEM_ALIGN (8)
typedef struct pool_t {
struct pool_t *next;
@@ -99,6 +100,9 @@ mem_pool_t *mem_pool_create(size_t obj_size)
if (mem == NULL)
return NULL;
+ if (obj_size % MEM_ALIGN)
+ obj_size += MEM_ALIGN - obj_size % MEM_ALIGN;
+
for (;;) {
total = pool_size_from_bitmap_count(count, obj_size);
if (total > DEF_POOL_SIZE)