diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-06-08 17:07:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-06-08 17:09:30 +0400 |
commit | b707b07c5b9f9c952ceab5135aab77ca58eb7d49 (patch) | |
tree | 863253fe22cf4c87d476009b1dcbbaf1277b4a20 /source/blender/blenlib/intern/BLI_mempool.c | |
parent | c6ea6e368b90b69b9e97aeb557b7bde6dce8f44c (diff) |
Fix mempool bottleneck alloc & freeing a single item
Would continuously reinitialize the first chunk of the mempool,
now check for at least 2 blocks.
Diffstat (limited to 'source/blender/blenlib/intern/BLI_mempool.c')
-rw-r--r-- | source/blender/blenlib/intern/BLI_mempool.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 448fefa5979..8fc5f97221d 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -409,7 +409,9 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) #endif /* nothing is in use; free all the chunks except the first */ - if (UNLIKELY(pool->totused == 0)) { + if (UNLIKELY(pool->totused == 0) && + (pool->chunks->next)) + { const unsigned int esize = pool->esize; BLI_freenode *curnode; unsigned int j; |