OutOfMemoryException for a line of code

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
JimmyF85
Posts: 4
Joined: Thu Oct 21, 2010 10:57 pm

OutOfMemoryException for a line of code

Post by JimmyF85 »

When I change the goal of a servo in SingleEntityAngularMotor I get OutOfMemoryException after a while.

I have 50 ragdolls and a SingleEntityAngularMotor attached to each limb
in every Update() I change the goal of each SingleEntityAngularMotor, and when I comment out that line that changes the servo's goal I dont get the error

I should also add that I reset the scene every 10 seconds, and this only happens when I use this line:
glMotor[m].Settings.Servo.Goal = newGoal;

I looked at the Demos source, and I think I am doing everything the demo does when resetting the scene

Any ideas why this might be happening? Maybe a bug when changing the goal of the SingleEntityAngularMotor in servo mode?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: OutOfMemoryException for a line of code

Post by Norbo »

Setting that property activates the entity if it isn't already active, and sets a quaternion field value. It shouldn't be able to do fill up memory by itself. There could be some weird external factors which cause the activation process to pile garbage (I don't know what they'd be), but I have no idea how it might fill up memory without the GC clearing things up.

I suggest running the CLR profiler to see what exactly is taking up the space and where it's coming from.
JimmyF85
Posts: 4
Joined: Thu Oct 21, 2010 10:57 pm

Re: OutOfMemoryException for a line of code

Post by JimmyF85 »

Thanks for the quick answer, but I think I fixed it now.

Don't know what the problem was though, I basically copied the whole structure of the BEPUphysicsDemos and added my game as a Demo
Post Reply