playMaker

Author Topic: Playmaker Garbage Collect Freeze  (Read 3095 times)

Sly

  • Full Member
  • ***
  • Posts: 123
Playmaker Garbage Collect Freeze
« on: December 03, 2019, 03:40:57 PM »
Hello,

I actually having some issue (short freeze) with Garbage Collect when I play my game. I saw on the profiler it came from Playmaker GC.Collect.
Like mentioned on other topic, I profile my game on a build, and not in the unity editor, but it still happen.

I'm actually using a custom actions that I've made, but I don't understand how I can trace where it came from. Is there a way to?
Is it better to use a FinishFSM action at the end of none active FSM?

Note: Regarding other thread about it, I never use Run Fsm Template (who can apparently create some issue). But I use Run Fsm in various way.

Thanks in advanced!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Playmaker Garbage Collect Freeze
« Reply #1 on: December 03, 2019, 10:38:49 PM »
Hi.
i use several run fsms but did not have issues with it yet.

usually if garbage collect freeze the game it mean that there is a lot of garbage

Do you use many create/destroy actions (for example bullets/enemies) ?

if so you might want to look into pooling.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Playmaker Garbage Collect Freeze
« Reply #2 on: December 04, 2019, 01:12:07 AM »
Also, the profiler works well with Playmaker. Click the deep profile button when you game is playing. Look for any visual spikes in the profile and set the timeline to that location.

Try changing your profiler to Heirchery. Then expand sections with the most garbage. Keep expanding them until you find the source of the most amount of garbage collection. It should give you the method or methods that are causing the most problem.


Sly

  • Full Member
  • ***
  • Posts: 123
Re: Playmaker Garbage Collect Freeze
« Reply #3 on: December 04, 2019, 08:03:20 AM »
Hello,

Because my game is generating randomly the level, I create a lot's of object at beginning (during loading). But not really after.
I've made a pooling system for my sounds and visual effect (to avoid create/destroy), and most of my NPC are spawned during loading.

I just don't understand where to find what is fulling the GC. Even in the deep profile, I just see PlayMakerFSM.Update() -> GC.Collect.
How can I know what's going on?

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Playmaker Garbage Collect Freeze
« Reply #4 on: December 04, 2019, 08:50:11 AM »
You cannot open a deeper level than the update method? Can you share a screenshot?

Sly

  • Full Member
  • ***
  • Posts: 123
Re: Playmaker Garbage Collect Freeze
« Reply #5 on: December 04, 2019, 09:11:23 AM »
That's the problem, even with the deep profile, I'm not seeing anything else than PlayMakerFSM.Update() and GC.Collect :/

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Playmaker Garbage Collect Freeze
« Reply #6 on: December 04, 2019, 09:39:23 AM »
With all that open, click on the GC column, to sort the highest items of GC to the top.

For example, we can see that the weapon property update is 13.3.

Sly

  • Full Member
  • ***
  • Posts: 123
Re: Playmaker Garbage Collect Freeze
« Reply #7 on: December 04, 2019, 10:01:31 AM »
With this I agree that weapon property has 13,3, and it's a lot. But still PlaymakerFSM.Update is at 104. That's the thing I don't understand. What cause this and how to find out.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Playmaker Garbage Collect Freeze
« Reply #8 on: December 05, 2019, 01:08:24 AM »
Hi,

 in these cases, it's often not Playmaker but the content you are working with inside PlayMaker that is the issue.

So can you check your prefab that you use int he pool on its own, and see what kind of garbage memory is uses? try to remove features and test if you are in a blur as to what's going on. do that until you don't have GC and deduce that it's the last part you disabled that causes it.

Bye,

 Jean

Sly

  • Full Member
  • ***
  • Posts: 123
Re: Playmaker Garbage Collect Freeze
« Reply #9 on: December 05, 2019, 02:04:40 PM »
Hello,

Thanks for your answer.
I'm actually trying to deactivate and optimize my fsm.

I note that some custom action download from Ecosystem are not always optimize (100% of case it is not from Dev of Playmaker). Like having GetComponent X3 in an update function :/

Anyway, I try to optimize ny stuff and let you know the result!

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Playmaker Garbage Collect Freeze
« Reply #10 on: December 09, 2019, 09:37:43 AM »
Hi,

 Please report to me actions you spot as not being optimized, I'll take care of that. thanks :)

as for the gc collection, if you can share the prefab that causes this, I'll have a look, pm me.

Bye,

 Jean

Sly

  • Full Member
  • ***
  • Posts: 123
Re: Playmaker Garbage Collect Freeze
« Reply #11 on: December 10, 2019, 11:10:07 AM »
Salut Jean!

As an example I notice the action IsVisibleInCameraFrustrum. There is multiple getComponent in the OnUpdate function.
(I'm not a professional coder, more an amateur autodidact so I can't say more).

The other thing I notice it's the PlaymakerGUI.OnGUI() who make 0.8KB in the GC alloc. I'm not using any action for the GUI and when I deactivate PlayMakerGUI, I just have few bytes in the GC alloc.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Playmaker Garbage Collect Freeze
« Reply #12 on: December 12, 2019, 07:23:21 AM »
Hi,

 yes, remove the PlaymakerGUI ( you need to turn it off in the settings, else it comes back).

it's important to make sure you get the information of what takes up memory using the profiler, chasing the other way is going to be counter productive.

but yes, indeed that action can be optimized. To check if it the source of your trouble, remove it from the logic and check if the profiler witnesses less memory consumption.

Bye,

 Jean