Closed CrazyFlasher closed 5 years ago
In general, SkeletonData objects are reused, and multiple buildSpriteSkeletons do not generate a large number of SkeletonData objects. Is there a more detailed information on the object of the memory leak?
Is there a Sprite object leak that can be used with isNative? I didn't do ObjectPool processing on Sprite
Simple example that causes crash during short period of time
var openflSprite:SkeletonAnimation;
spineTextureAtals.load(function(textureAtals:SpineTextureAtals):Void{
Lib.setInterval(() -> {
if (openflSprite != null)
{
openflSprite.parent.removeChild(openflSprite);
openflSprite = null;
}
openflSprite = textureAtals.buildSpriteSkeleton("wild",jsonData);
this.addChild(openflSprite);
openflSprite.y = 300;
openflSprite.x = 300;
openflSprite.play(cast(openflSprite.state.getData().getSkeletonData().animations[0]));
openflSprite.scaleX = 0.6;
openflSprite.scaleY = 0.6;
openflSprite.isNative = true;
}, 200);
},function(error:String):Void{
trace("Error:",error);
});
Looks like calling openflSprite.destroy();
resolved the fast memory leak issue
Probably because the Event.ENTER_FRAME event did not stop after the object was removed.
What is the best way to duplicate SkeletonAnimation? Calling buildSpriteSkeleton many times causes memory leaks and crash. Especially, if setting isNative to true