diff options
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/BLI_mempool.c | 10 | ||||
-rw-r--r-- | source/blender/blenlib/intern/edgehash.c | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index c8917897185..3c158faaa1b 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -311,10 +311,12 @@ BLI_mempool *BLI_mempool_create(unsigned int esize, unsigned int totelem, #endif pool->totused = 0; - /* allocate the actual chunks */ - for (i = 0; i < maxchunks; i++) { - BLI_mempool_chunk *mpchunk = mempool_chunk_alloc(pool); - lasttail = mempool_chunk_add(pool, mpchunk, lasttail); + if (totelem) { + /* allocate the actual chunks */ + for (i = 0; i < maxchunks; i++) { + BLI_mempool_chunk *mpchunk = mempool_chunk_alloc(pool); + lasttail = mempool_chunk_add(pool, mpchunk, lasttail); + } } #ifdef WITH_MEM_VALGRIND diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index c191d8b5b55..1d0e62dfdf6 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -190,7 +190,7 @@ static EdgeHash *edgehash_new(const char *info, } eh->buckets = MEM_callocN(eh->nbuckets * sizeof(*eh->buckets), "eh buckets"); - eh->epool = BLI_mempool_create(entry_size, 512, 512, BLI_MEMPOOL_NOP); + eh->epool = BLI_mempool_create(entry_size, nentries_reserve, 512, BLI_MEMPOOL_NOP); return eh; } |