Cycles: Free memory used by intermediate BVH vectors earlier

Ideally we should get rid of those temporary vectors anyway, but
it's not so trivial because of the alignment. For untl then we'll
just have a bit worse solution. This part of code is not the root
of the issue of memory spikes for now anyway.

But since we're getting rid of temporary memory earlier actual spike
is a bit smaller as now. For example in franck_sheep file it's now
5489.69MB vs. previously 5599.90MB.
This commit is contained in:
Sergey Sharybin 2015-02-19 18:58:21 +05:00
parent 0f652501c7
commit 3bc9ac19f5
1 changed files with 4 additions and 1 deletions

View File

@ -205,6 +205,9 @@ void BVH::build(Progress& progress)
pack.prim_type = prim_type;
pack.prim_index = prim_index;
pack.prim_object = prim_object;
prim_type.free_memory();
prim_index.free_memory();
prim_object.free_memory();
/* compute SAH */
if(!params.top_level)
@ -227,7 +230,7 @@ void BVH::build(Progress& progress)
/* pack nodes */
progress.set_substatus("Packing BVH nodes");
pack_nodes(root);
/* free build nodes */
root->deleteSubtree();