Commit: b707b07c5b9f9c952ceab5135aab77ca58eb7d49
Author: Campbell Barton
Date:   Sun Jun 8 23:07:00 2014 +1000
https://developer.blender.org/rBb707b07c5b9f9c952ceab5135aab77ca58eb7d49

Fix mempool bottleneck alloc & freeing a single item

Would continuously reinitialize the first chunk of the mempool,
now check for at least 2 blocks.

===================================================================

M       source/blender/blenlib/intern/BLI_mempool.c

===================================================================

diff --git a/source/blender/blenlib/intern/BLI_mempool.c 
b/source/blender/blenlib/intern/BLI_mempool.c
index 448fefa..8fc5f97 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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to