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:
authorAntony Riakiotakis <kalast@gmail.com>2013-08-21 19:21:56 +0400
committerAntony Riakiotakis <kalast@gmail.com>2013-08-21 19:21:56 +0400
commitdcddd32c4553d5096f376434cd426f987ec3dd2e (patch)
tree4ce64a772e1bc8e0996317c8747284f8f14a1511 /source/blender/blenkernel/intern/pbvh.c
parentfca659252f56d3487cf64fe702cb96c379cc89c6 (diff)
Scultping: Growing the pbvh node container should use malloc instead of
calloc. Since we copy the first 1/1.3 part of the new array from the existing nodes, only the rest 0.3/1.3 should be initialized to zero. This should in theory cut down the times of occasional hangs with dyntopo, since my guess is that it is caused by dynamic reallocations. Maybe a linked list structure would help here? This is a bigger change though, leaving as is for now. Also, minor cleanup, delete duplicate ghash deletion and remove unneeded commented code.
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh.c')
-rw-r--r--source/blender/blenkernel/intern/pbvh.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 205159c94a1..4f8536e8962 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -229,9 +229,10 @@ void pbvh_grow_nodes(PBVH *bvh, int totnode)
bvh->node_mem_count *= 1.33;
if (bvh->node_mem_count < totnode)
bvh->node_mem_count = totnode;
- bvh->nodes = MEM_callocN(sizeof(PBVHNode) * bvh->node_mem_count,
+ bvh->nodes = MEM_mallocN(sizeof(PBVHNode) * bvh->node_mem_count,
"bvh nodes");
memcpy(bvh->nodes, prev, bvh->totnode * sizeof(PBVHNode));
+ memset(bvh->nodes + bvh->totnode, 0, (bvh->node_mem_count - bvh->totnode) * sizeof(PBVHNode));
MEM_freeN(prev);
}