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
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-02-17 15:27:15 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-03-13 15:38:03 +0300
commit0e18a5643239203385258b7d64f2d6b15594fa46 (patch)
treee12298d4611418f4249197ef8b3e4adfc530fd85 /intern
parent79393cb7a2dfef3bd7205b1a68558aaba2f2b5da (diff)
Cycles: Free caches used by the synchronized objects
Issue this commit is addressed to is that particle system and particle modifier will contain caches once derived mesh was requested and this cached data will never be freed. This could easily lead to unwanted memory peaks during synchronization stage of rendering. The idea is to have RNA function in object which would free caches which can't be freed otherwise. This function is not intended to deal with derived final since it might be used by other objects (for example by object with boolean modifier). This cache freeing is only happening in the background rendering and locked interface rendering. From quick tests with victor file this change reduces peak memory usage by command line rendering by around 6% (1780MB vs. 1883MB). For rendering from the interface it's about 12% (1763MB vs. 1998MB). Reviewers: campbellbarton, lukastoenne Differential Revision: https://developer.blender.org/D1121
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/blender_mesh.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index ba6bbf1bcbd..c70ffea39c3 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -20,6 +20,7 @@
#include "scene.h"
#include "blender_sync.h"
+#include "blender_session.h"
#include "blender_util.h"
#include "subd_mesh.h"
@@ -588,6 +589,14 @@ static void create_subd_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, PointerR
Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris)
{
+ /* When viewport display is not needed during render we can force some
+ * caches to be releases from blender side in order to reduce peak memory
+ * footprint during synchronization process.
+ */
+ const bool is_interface_locked = b_engine.render() &&
+ b_engine.render().use_lock_interface();
+ const bool can_free_caches = BlenderSession::headless || is_interface_locked;
+
/* test if we can instance or if the object is modified */
BL::ID b_ob_data = b_ob.data();
BL::ID key = (BKE_object_is_modified(b_ob))? b_ob: b_ob_data;
@@ -681,6 +690,10 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
if(render_layer.use_hair)
sync_curves(mesh, b_mesh, b_ob, false);
+ if(can_free_caches) {
+ b_ob.cache_release();
+ }
+
/* free derived mesh */
b_data.meshes.remove(b_mesh);
}