In Flash Builder Profiler, I'm seeing a severe memory leak B2Vec2 Box2D Common.Math that eventually crashes my air app.
How do I stop this leak? I've seen many posts reporting this same issue, but no answers yet.
I've tried all the Destroy Body approaches, ClearForces(), and even System.gc() to attempt to get rid of the leak. Nothing helps.
I'd appreciate any help very much.
Thanks!
Don
I'm simply adding about 20-40 bodies that when they collide, I use this code
private function onBodiesContact(e:b2ContactEvent):void
{
var b1:UIComponent = e.contact.GetFixtureA().GetBody().GetUserData();
var b2:UIComponent = e.contact.GetFixtureB().GetBody().GetUserData();
var bBody1:b2Body = physicsContainer.getComponentBody(b1);
if(bBody1 !== null){
bBody1.ApplyForce(new b2Vec2(30,-30),bBody1.GetDefinition().position);
}
var bBody2:b2Body = physicsContainer.getComponentBody(b2);
if(bBody2 !== null){
bBody2.ApplyForce(new b2Vec2(-30,30),bBody2.GetDefinition().position);
}
}
How do I stop this leak? I've seen many posts reporting this same issue, but no answers yet.
I've tried all the Destroy Body approaches, ClearForces(), and even System.gc() to attempt to get rid of the leak. Nothing helps.
I'd appreciate any help very much.
Thanks!
Don
I'm simply adding about 20-40 bodies that when they collide, I use this code
private function onBodiesContact(e:b2ContactEvent):void
{
var b1:UIComponent = e.contact.GetFixtureA().GetBody().GetUserData();
var b2:UIComponent = e.contact.GetFixtureB().GetBody().GetUserData();
var bBody1:b2Body = physicsContainer.getComponentBody(b1);
if(bBody1 !== null){
bBody1.ApplyForce(new b2Vec2(30,-30),bBody1.GetDefinition().position);
}
var bBody2:b2Body = physicsContainer.getComponentBody(b2);
if(bBody2 !== null){
bBody2.ApplyForce(new b2Vec2(-30,30),bBody2.GetDefinition().position);
}
}