Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: elusiven on February 24, 2017, 08:20:02 AM

Title: Memory keeps growing[SOLVED]
Post by: elusiven on February 24, 2017, 08:20:02 AM
Hi,

While using the app, I've noticed that the memory just keeps growing and growing, and it doesn't decrease, so eventually after playing 20-30 minutes it will crash. I know about profiler, but it doesn't seem to show the exact points/variables where the memory is assigned etc.. Or It might but I don't know where to look. And it's definitely an FSM that is doing this since it's only when I click certain things but without knowing what exactly causes this it's hard for me to find out as there is +100 fsms and a lot of variables.
Title: Re: Memory keeps growing
Post by: elusiven on February 24, 2017, 09:48:47 AM
Ok I think I worked out that it's Easy Save 2.

ES2LoadObjectAction'1.OnEnter()  - Allocates 1.1MB

and the same one, but allocates 4.8MB 

This happens a few times, and all in total it allocates about 10-15MB, and it seems like it's not disposing but it does execute some dispose() method because I can see in the profiler... Any ideas?

Also a question regarding performance of datamaker... I load an xml to the proxy when the app starts, and I'm querying it very extensively. Is there a performance decrease of having the data in the proxy all the time, do I like need to load it only when I want to query the data and then dispose the proxy off data or that is not needed and It can just be loaded and it can stay in proxy until app quits?
Title: Re: Memory keeps growing
Post by: djaydino on February 24, 2017, 10:31:54 AM
Hi,
For ES2 i don't Know what the issue is, maybe you can better aks on the ES2 forum.

For Datamaker it would be better for performance to load it once,
it will use a small part of your memory but it will not affect you performance.

if you would reload it every time, it could affect performance but even that i think is minimal.

But in theory loading once is best for performance.
Title: Re: Memory keeps growing
Post by: elusiven on February 27, 2017, 11:13:01 AM
Okay I noticed that there are 4 new textures each time I enter this mini-game. So it's piling up unused textures and not destroying them. What works is to call Remove Unused assets but that's not very efficient and it only removes new ones, the first ones still stay in the memory, as if they are being used but they are not, is there an alternative to mark those textures for GC? - I don't see them in the inspector or as a variable, I only see sprites and I already tried deleting Sprites textures and this does not help because the images go black.

Any ideas please?
Title: Re: Memory keeps growing
Post by: jeanfabre on March 01, 2017, 12:52:19 AM
Hi,

 Textures are not created out of the blue, so you need to find out where and why your mini game needs to create textures, and then debug that to see why it keeps creating texture.

Also, an Fsm in itself doesn't do anything apart from running actinos, so you have to look at the actions you use, that's where things are likely starting.

 Are you using other assets that could be linked to creating textures?

Bye,

 Jean
Title: Re: Memory keeps growing
Post by: elusiven on March 01, 2017, 08:10:00 AM
I fixed it now... I was removing the textures that were still in use - that's why the images were going black. I moved my modified destroy action to end of level and it works, after the level is finished the textures get destroyed and then when it starts again they get created again.

Thanks
Title: Re: Memory keeps growing
Post by: jeanfabre on March 03, 2017, 06:36:05 AM
Hi,

 Good, I am glad you found the issue.

 Bye,

 Jean