Suppose a sprite is attached to a box2d body.
And
world.destroyBody(b);
is getting called then the sprite also get destroyed or it stays there in memory.
In my situation lots of box2d bodies are getting created and destroyed and after a delay of few seconds the sprite disappears.
Here's the snippet of where body is getting destroyed:
@Override
public void act(float delta) {
super.act(delta);
camera.update();
world.step(1/60f, 6, 3);
if (enemy_destroy) {
Array<Body> bodies = new Array<Body>();
world.getBodies(bodies);
for(int i = 0; i < bodies.size; i++) {
Body b = bodies.get(i);
if (b.getUserData() instanceof Boolean) {
world.destroyBody(b);
b.setActive(false);
}
}
}
}