I finally solved this yesterday, turned out the issue came from dragonbones lib.
I still don’t know how to debug the crash I described, as I know nothing about c++. I was working on the game’s options and figured “combat speed” would be a nice one to have, and added it pretty easily using starling’s Juggler and dragonbones WorldClock. This gave me the idea to boost it up to a stupidly high value like 20 to see if it would help reproduce the crash a lot faster, which worked.
From there I added some config to be able to disable my visual FX system, which was not at fault, then did the same to disable dragonbones - displaying starling quads instead. This allowed me to see that the crash never occurred with dragonbones turned off.
I started looking into dragonbones code and saw some things that looked weird, such as doing this to clear a map :
for (k in boneTimelines.keys())
{
boneTimelines[k].returnToPool();
boneTimelines.remove(k);
}
Unless I’m missing something this is gonna leave almost half the entries inside boneTimeLines
I started modifying these parts but it didn’t seem to help in my case. Everytime I looked at my crashes in Visual Studio’s debugger I would see a lot of Vectors so I thought why not replacing all Vectors in dragonbones with Arrays… and after that no more crashes couldn’t believe it at first but I triple-checked and it’s definetely not there anymore (yay !)
I’m not sure what the issue is exactly : dragonbones does a lot of
Vector.fixed = false;
(add or remove stuff)
Vector.fixed = true;
It also uses a lot of
Vector.length = 0;
and
Vector.length = desiredLength;
I think the crash comes from one of these, or a combination it’s hard to tell.
Also I think I have only seen the crash occurring when “disposing” Armature instances : everything gets returned to pool to be re-used later.
Finally there is still a memory leak (at least when used with Starling) occurring on windows target (I guess it happens on any c++ target but only tested Windows so far). My changes didn’t seem to help with it. I will eventually try to find it out but for now it’s small enough that I can live with it
If anyone is interested, the modified version of dragonbones is available here : https://github.com/MatseFR/dragonbones
warning 1 : I only changed the core and starling parts, didn’t change openFL Fixel or Flash parts (I’ll do it if someone needs it, let me know)
warning 2 : I like to have control over the Armatures getting added to the WorldClock so I disabled the code that does it automatically in StarlingFactory
I’ll probably create a thread about those issues with Dragonbones later, hopefully with more precision