DEV Community

Peter Witham
Peter Witham

Posted on

Don't forget the leaks

I had spent the best part of a week on and off trying to fix an issue I was having with SpriteKit, one of the gaming frameworks on the Apple platforms.

This was the last bug between development and shipping the 1.0 release, but it was a big one.

I was getting repeated audio and animations where I should only be seeing and hearing them once. After all, how many times does a player have to die to indicate they dead?…once right?

I had re-written, re-architected the code numerous times and was convinced that I had everything right each time. There are only so many ways to change an image and play a sound after all.

Through out the process I had been live streaming the development at like I always do. And many more talented folks than I in the chatroom had suggested things that we tried with no solution in sight.

Then, someone whom I hold in high regard for SpriteKit said they would be happy to take a look at the whole codebase for me. After much defeat and imposter syndrome, I gave in and handed over the code base.

After a while they got back to me and said “Hey, I think you have a leak and retainer in the game scene”.

Now, I had looked at this, but did not see what they had seen. Maybe due to lack of observation on my part, or maybe code blindness had set in.

But sure enough, they were right. Two lines of code changes later everything started to fit into place and away it went happily just taking down the player once.

So there are two lessons here I want to share.

  1. Always take help when it’s offered
  2. Don’t forget to check beyond the code structure and see if something unexpected or unplanned is happening outside of the logic it’s self.

For now, I am sending the last version to TestFlight and hoping for a 1.0 release in the coming week or two.

Top comments (0)