playMaker

Author Topic: Optimization - Memory  (Read 2392 times)

MarkD

  • Full Member
  • ***
  • Posts: 113
Optimization - Memory
« on: April 29, 2015, 01:32:51 AM »
Hey guys,

While this question isn't exactly specific to Playmaker, I'm using Playmaker heavily in my game and you guys are always awesome about answering questions I hope you can help point this novice in the right direction.

My game is close to being complete and I'm finding that after playing for a few minutes, things start to slow down and become choppy. 

So - I've got the profiler window open and I'm watching the memory section.  "Used total" is a number that caught my attention - it started off around 377-381, fluctuating back and forth.  After a few minutes, I noticed the range started increasing higher.  After 10-15 minutes, the range is now up to 437-441 and climbing.

That seems to be an indicator of a problem but I have no idea what to do next to troubleshoot it.  FYI - in the game I'm not doing anything but letting it run and this happens.

Any advice on how to start finding more clues to this mystery?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Optimization - Memory
« Reply #1 on: April 29, 2015, 02:14:34 AM »
Hi,
 
Yep :) you are likely having GameObject being created and you never destroy them.

Can you check your Hierarchy, and locate where you actually instanciate prefabs and all, double check that you properly clean up when prefabs should be deleted.

also, are you loading scenes additivly? this is a source of great memory leak unfortunatly.

Bye,

 Jean

MarkD

  • Full Member
  • ***
  • Posts: 113
Re: Optimization - Memory
« Reply #2 on: April 29, 2015, 11:57:02 AM »
Hey Jean - thanks for the quick reply!

I have several "traps" in my scene that the player must negotiate through, most of which are prefab objects that stay in the scene but they're not creating anything, I'm just activating pieces collision triggers and FX.

However, I do have a fireball launcher that shoots a sphere up into the air and a few seconds later the sphere is destroyed.  I've attached a screenshot to show you how I've got it setup.  The short version is - an empty game object loads a prefab sphere, the sphere spawns in and launches itself up into the air, and then a few seconds later destroys itself.

As for additive scenes, I don't think I'm doing that, though that would explain why I load scenes between my main game level I don't see the numbers reset to where they started from.  I went through all of the FSM's where I'm calling Load Level and I don't have additive checked.  Is there somewhere else that additive could be set?

Thanks a ton for the help!






mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Optimization - Memory
« Reply #3 on: April 29, 2015, 03:13:53 PM »
Create/Destroy are often heavy actions, have you tried incorporating a Pool Manager to help spawn the objects?