Stumped - font memory leak

50 views
Skip to first unread message

John Grden

unread,
Feb 18, 2011, 12:36:42 AM2/18/11
to unity3d-d...@googlegroups.com
well, I finally narrowed down where I was loosing memory and it turned out to be that whenever I changed a value of a GUI Label, a some memory was being consumed and never returned.

I changed it to use the default font without a style setting and same thing happens.  I've changed the font settings to ASCII Default Set, Dynamic and that didn't make a difference.

So, now I'm stumped as to what the issue could be.  This didn't seem to be the case in 3.1, i'm running 3.2f4

Any ideas?

--
[  JPG  ]

Cliff Owen

unread,
Feb 18, 2011, 9:54:51 AM2/18/11
to unity3d-d...@googlegroups.com
I’ve seen the garbage collector go nuts, at times, from what seemed like string manipulation. Instead of the font, perhaps it’s the strings? I don’t think it was actually losing the memory, rather memory fragmentation issues from lots of little allocations. I got the feeling that the allocation strategy wasn’t very efficient.

It’s not overly helpful, other than suggesting that you may be able to do something with the strings to work within existing memory and avoid the string copy, which typically causes an allocation.... And then see if that helps. My issue involved a Debug.Log(), and so all I had to do was remove it and my memory issues went away. I doubt it’s that easy for you. :)

John Grden

unread,
Feb 18, 2011, 5:15:56 PM2/18/11
to unity3d-d...@googlegroups.com
Turned out to be a true bug with GUI.Label in 3.2 - I was able to reproduce every time.  I've reported it.

The work around was to use GUIText, which I actually enjoyed since it allowed me to edit at design time

--
You received this message because you are subscribed to the Google
Groups "Unity3D Developers" group.
To post to this group, send email to unity3d-d...@googlegroups.com
To unsubscribe from this group, send email to
unity3d-develop...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/unity3d-developers?hl=en



--
[  JPG  ]

John Grden

unread,
Feb 18, 2011, 5:16:45 PM2/18/11
to unity3d-d...@googlegroups.com
So,  all that to say, if you're producing an app with 3.2 and using GUI.Label, you should check your memory.  If you see it creeping up when a GUI.Label is updated/changed, there's your answer.

On Fri, Feb 18, 2011 at 8:54 AM, Cliff Owen <cli...@swiftcreekgames.com> wrote:

--
You received this message because you are subscribed to the Google
Groups "Unity3D Developers" group.
To post to this group, send email to unity3d-d...@googlegroups.com
To unsubscribe from this group, send email to
unity3d-develop...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/unity3d-developers?hl=en



--
[  JPG  ]

Elliott Mitchell

unread,
Feb 18, 2011, 5:31:00 PM2/18/11
to unity3d-d...@googlegroups.com

Have you tried mesh text? We have had lots of luck with it esp if you port to a web build or need to scale a project in the browser... seems flexible
-E

John Grden

unread,
Feb 18, 2011, 5:41:32 PM2/18/11
to unity3d-d...@googlegroups.com
no haven't tried that, but sound interesting!
Reply all
Reply to author
Forward
0 new messages