[Bf-blender-cvs] [b707b07] master: Fix mempool bottleneck alloc & freeing a single item

Campbell Barton noreply at git.blender.org
Sun Jun 8 15:10:01 CEST 2014


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;




More information about the Bf-blender-cvs mailing list