Memory Leak

Discuss issues specific to the Flash/AS3 port of Box2D
Posts: 13
Joined: Thu Mar 20, 2008 11:41 am

Memory Leak

Postby northway » Fri Sep 07, 2012 5:37 pm

Line 295 of b2DynamicTree instanciates a static variable that is never cleared. This can cascade back to your game through UserData variables and keep the garbage collector from clearing out bits of your game.

private static var s_stack:Vector.<b2DynamicTreeNode> = new Vector.<b2DynamicTreeNode>();

Hacky fix, since no one us updating Box2d Flash anymore:

Make s_stack public and then when you want to unload Box2d just reinitialize it:
b2DynamicTree.s_stack = new Vector.<b2DynamicTreeNode>();

Colin Northway

Return to “Flash”

Who is online

Users browsing this forum: No registered users and 1 guest