Has anyone profiled a Box2D game in Flex/Flash Builder? I have, just this evening, and I didn't really like the results. I originally profiled my game because it was having significant slowdown whenever I started adding, I guess, "too many" physics objects on the screen. I have "chains" (made up of ~6 revolute joints each) attached to floating spheres in a buoyancy half-plane. I watched the profile of my game with these chains, and box2d is using 30% of the total memory to hold vectors (b2Vec2). That can't be right, can it?
After 120 seconds of play, there were 495,345 "new b2Vec2" calls, with 11,000 currently in use (after garbage collection was run). I've checked all my objects, and they're all cleaned up, removed from the game, removed from memory, when they're no longer in use. I've double checked that everything that gets Added to Box2D is Removed, and everything that's Created is Destroyed. That's a lot of b2Vec2s for the engine to be holding on to. I'd like to think I'm doing something wrong. Eleven-thousand vectors for ~130 total objects seems disproportionately high to me.
For more numbers, there are, in the same memory snapshot (descending from most number of alive instances after b2Vec2):
1408 b2Mat22
1145 b2Vec3
1067 b2DynamicTreePair
695 b2ContactID
695 Features
688 b2ManifoldPoint
559 b2AABB
(more available, if it's helpful)
After 120 seconds of play, there were 495,345 "new b2Vec2" calls, with 11,000 currently in use (after garbage collection was run). I've checked all my objects, and they're all cleaned up, removed from the game, removed from memory, when they're no longer in use. I've double checked that everything that gets Added to Box2D is Removed, and everything that's Created is Destroyed. That's a lot of b2Vec2s for the engine to be holding on to. I'd like to think I'm doing something wrong. Eleven-thousand vectors for ~130 total objects seems disproportionately high to me.
For more numbers, there are, in the same memory snapshot (descending from most number of alive instances after b2Vec2):
1408 b2Mat22
1145 b2Vec3
1067 b2DynamicTreePair
695 b2ContactID
695 Features
688 b2ManifoldPoint
559 b2AABB
(more available, if it's helpful)