playMaker

Author Topic: Garbage collection issues. What to avoid?  (Read 2655 times)

jasperPT

  • Full Member
  • ***
  • Posts: 115
  • I am a VFX Animator teaching myself to make games
Garbage collection issues. What to avoid?
« on: February 26, 2015, 08:46:07 PM »
So I seem to be having some garbage collection issues of recent and I'm not sure what is causing it.

Every 10 seconds on my ipad the game freezes for a second or so which is quite frustrating.
I tried everything and couldn't figure out what was causing it so I installed the pro trial liscence of unity to get the Profiler running and it looks to me like it is a garbage collection issue that is spiking every 10 seconds.

This is my first time making a game so maybe I have done a couple of things that are obviously wrong to cause this, what are the usual suspects? Is there a way to force it to collect garbage more regularly so there is less build up?

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Re: Garbage collection issues. What to avoid?
« Reply #1 on: February 27, 2015, 12:25:52 AM »
are you instantiating objects every 10 seconds?  I don't know about playmaker and garbage, but if you create too many things or if your memory fills up, then that could cause a slowdown. 

jasperPT

  • Full Member
  • ***
  • Posts: 115
  • I am a VFX Animator teaching myself to make games
Re: Garbage collection issues. What to avoid?
« Reply #2 on: February 27, 2015, 03:03:33 AM »
Everything I create is done with pool manager, the whole scene is created when the level loads.

Im also using 2dTK for sprites and camera if that makes any difference.

jasperPT

  • Full Member
  • ***
  • Posts: 115
  • I am a VFX Animator teaching myself to make games
Re: Garbage collection issues. What to avoid?
« Reply #3 on: March 01, 2015, 04:16:32 PM »
Still having issues with this, any thoughts on best ways to reduce the garbage?

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: Garbage collection issues. What to avoid?
« Reply #4 on: March 02, 2015, 05:17:00 AM »
I've not really had a proper look at the profiler,  but have you tried pausing it at the moment there is a spike and have a look in the profiler at that point to see what is causing it. 

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Garbage collection issues. What to avoid?
« Reply #5 on: March 02, 2015, 05:33:21 AM »
Hi,

 Indeed, you'll need to first find exactly what is causing this spike.

 Try to first identify it in the editor, you should likely witness these spikes, maybe at different intervals if it is indeed the garbage collector.

 actually it if is, you'll get a log in xcode when you run it on the device from xcode, so I would first look into the xcode log.

 Bye,

 Jean