• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

iOS Cleanup event causing exceptions in iOS

clee2005

Member
I'm seeing some strange exceptions and I think I MAY have narrowed it down to being the cleanup event. I went back and removed all the Cleanup events and put the code back into Destroy and Room End events and the exceptions went away as shown in analytics. (1st arrow shows a release with half the Cleanup events removed, 2nd arrow is with all the Cleanup events removed).

upload_2019-6-11_10-9-53.png

I just wanted to see if anyone else noticed anything. I don't know that the users get any crashing or if this is just an analytics logging thing... it doesn't register any issues in Android.

Here is one of the exceptions logged :



Chris
 

Attachments

Last edited:

FrostyCat

Redemption Seeker
In your pre-changeover code, are any of the Cleanup events in objects that also contain an existing Destroy or Room End event? If there are, you must make sure that neither the Destroy event nor the Room End event contains code for freeing resources. Double-freeing is one of many standard crash conditions.

As an additional note, you should post some examples of your Cleanup event code if you think that's where the problem may be.
 

clee2005

Member
@FrostyCat Yeah, I probably could have been a little clearer on what I was doing in the Cleanup events. Basically, I got excited about the using the Cleanup event instead of the Destroy and Room End (to ensure destroy fires). So I moved the code from the destroy to the Cleanup and removed the Destroy and Room End events. I did this for 15-20 objects. The cleanup code varied from just destroying objects, to structure cleanup (eg. ds_map_destroy). But the key point is that the EXACT same code put back into the destroy event and removing the Cleanup event seems to solve the exception issue.
 

FrostyCat

Redemption Seeker
@FrostyCat Yeah, I probably could have been a little clearer on what I was doing in the Cleanup events. Basically, I got excited about the using the Cleanup event instead of the Destroy and Room End (to ensure destroy fires). So I moved the code from the destroy to the Cleanup and removed the Destroy and Room End events. I did this for 15-20 objects. The cleanup code varied from just destroying objects, to structure cleanup (eg. ds_map_destroy). But the key point is that the EXACT same code put back into the destroy event and removing the Cleanup event seems to solve the exception issue.
DO NOT destroy instances in the Cleanup event. There are contexts where these instances could be inaccessible in that event, and other contexts where this could cause infinite recursion.

An example is at the end of a room. The engine is cleaning up non-persistent instances already, don't race with it by duplicating its work. If you think a few moves ahead, you'll see that there's something bound to go wrong no matter who wins.

In my experience, the only safe policy to take with the Cleanup event is a mind-your-own-business policy.
  • Don't destroy instances there.
  • Don't clean up resources belonging to other instances there.
  • Don't use object.variable anywhere in there.
 
Top