Page MenuHome

Aggressive memory cleanup for locked interface option
Changes PlannedPublic

Authored by Sergey Sharybin (sergey) on Feb 18 2015, 3:28 PM.

Details

Reviewers
None
Summary

Previously only derived meshed from "invisible" to renderer objects were freed,
which is nice but which could still potentially be a huge memory
waster.

The idea of this change is to get rid of as much derived meshes as possible.
Additionally, this change also makes it so no unneeded derived meshes will be
created during scene_update_for_newframe() invoked by the render pipeline.

Unfortunately, we can't get rid of all the derived meshes, because some of
them will actually be needed for such modifiers as boolean, shrinkwrap and
some other places. In order to deal with this, there's now special evaluation
flag which says "hey, whatever the case, derivedFinal is to be always created".
This is probably as good as we can do it with the current depsgraph.

Diff Detail

Repository
rB Blender
Branch
memory_agressive_clean

Event Timeline

Sergey Sharybin (sergey) retitled this revision from to Aggressive memory cleanup for locked interface option.
Sergey Sharybin (sergey) updated this object.

Generally looks good,

note: looks like it should have support for constraint modifiers that use mesh data.

source/blender/blenkernel/intern/object.c
3089–3090

Would be good to have some debuging way to know if the derivedFinal *is* used by the render (pink cube or so :D...).

Issue is this could fail and be annoying to track down each time.

Sergey Sharybin (sergey) edited edge metadata.

Some fixes:

  • Few constraints missed flag that they want to know somene's else DM
  • Added asserts where possible and where i found it's needed
Campbell Barton (campbellbarton) accepted this revision.EditedApr 2 2015, 6:41 AM
Campbell Barton (campbellbarton) edited edge metadata.

Generally think the approach is fine,

But while checking on the patch found it breaks dupli faces/verts in some cases.

This resolves the error.

diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 8690882..c7ad182 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -604,8 +604,14 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 					else
 						dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Curve Parent");
 				}
-				else
+				else {
 					dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Parent");
+					if (ob->parent->type == OB_MESH) {
+						if (ob->parent->transflag & (OB_DUPLIVERTS | OB_DUPLIFACES)) {
+							node2->eval_flags |= DAG_EVAL_NEED_DM_FOR_RENDER;
+						}
+					}
+				}
 				break;
 		}
 		/* exception case: parent is duplivert */
This revision is now accepted and ready to land.Apr 2 2015, 6:41 AM
Sergey Sharybin (sergey) edited edge metadata.

Fix for dupli issue reported by Campbell

Sergey Sharybin (sergey) planned changes to this revision.Apr 6 2015, 5:13 PM

There are some issues with dupligrups and hair, need to investigate before applying to master.