Found a very significant memory leak in MotionBuilder 2010 when adding keys to the animated double property – FBPropertyAnimatableDouble.

Here is my test property is intended to print out the quality of the object. Althoughin this case, the appointment of property is not so important.

1
FBPropertyAnimatableDouble Quality;

Initialize this property in the object’s constructor

1
FBPropertyPublish (this, Quality, "Quality", NULL, NULL);

Before working with it, prepare an animation curve

1
2
3
Quality.SetMinMax (0.0, 1.0);

Quality.SetAnimated (true);

And it is now be possible, and add some value

1
Quality.GetAnimationNode () -> KeyAdd (time, & value);

This is the option of adding keys to the property generates a very large-scalememory leaks! For example, after 9 thousand frames of adding keys in this way,Mobu eats about 2.5 GB of RAM!

Out of this situation is to add the key directly on the curve:

1
2
3
4
5
6
7
HFBFCurve fcurve = Quality.GetAnimationNode () -> FCurve;

fcurve->EditBegin ();

fcurve->KeyAdd (time, quality);

fcurve->EditEnd ();

So everything is working properly and without unnecessary leaks.

MoBu SDK bag: memory leaks on adding keys
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *