Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-04-08 05:59:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-04-08 06:58:56 +0400
commit412826a504a95c45b561893aa9cbaebd00d63702 (patch)
tree79450ca22b6456da674ffdfea59f3b380cb125dd /source/blender/blenlib/intern/BLI_mempool.c
parentcced07661a4fcfd156caec81073d97c060677a15 (diff)
Mempool: delay allocating an initial chunk, its not always used
Diffstat (limited to 'source/blender/blenlib/intern/BLI_mempool.c')
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c10
1 files changed, 6 insertions, 4 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