Thanks for that - that's very helpful information.

I'm getting dragged into diagnosis because on very low-spec machines our
app is tending to eat memory causing it to heavily slow down. I've managed
to diagnose some of these (use of setTimeout, Bindings that never go away)
which is liable to help hugely.

What I'm having difficulty in is determining what things in the profiler
are *genuine leaks*, and what things are things the GC will eventually get
to as they're weak references (I do the System.gc() and
newLocalConnection().connect(
'foo'); tricks beforehand, but they don't feel like they're reliable. It's
a shame there isn't a System.reallyreallyfullGCandIDontCareHowLongItTakes()
)

A good example is mx.core:EmbeddedFont. When the app is in use, this number
doubles. So I analyse an instance, and find only 1 path - which it states
as simply "mx.core:EmbeddedFont (1 Path), GC Root=YES" and allocated in
"mx.core:EmbeddedFontRegistry:GetAssociatedModuleFactory()".

What I believe that's telling me is that the reference is there because of
the static EmbeddedFontRegistry in EmbeddedFont, and it's being stored in
that registry in a cache (cachedFontsForObjects) - which is a weak
dictionary.

My gut instinct at this point is "this is irrelevant, it'll get GCed
eventually". Two things strike me though
  - I'm guessing that it's in that dictionary as the object reference view
stops at the EmbeddedFont, which seems a shame. That makes it difficult in
any code that's pretty complex
  - I'm guessing it'll be GCed. But I wonder now if *all* those things will
be GCed *eventually*. Why didn't the 'invoke GC' parts actually cause it to
be collected..



t
On Tue, Feb 5, 2013 at 7:32 PM, Alex Harui <aha...@adobe.com> wrote:

> **
>
>
> The true test of a leak is whether your OS’s process manager says that
> memory consumption keeps going up.
>
> Before we had a profiler, we would add code to the app to exercise some
> sequence (by faking button events, etc), force garbage collection, and
> report System.totalMemory over and over again and run it overnight.  Due to
> the way Flash manages memory, just manually exercising the sequence a few
> dozen times may show increasing memory even though there isn’t a leak,
> although really bad leaks will show up in System.totalMemory or in the OS
> process manager pretty quickly.  Leaky apps will eventualy crash the
> browser, or just report an endless increase in memory, way past what you
> would expect for an app of that size and complexity.
>
> Historically, the profiler has shown a dependency on the version of the
> Flash Player.  Whatever version of Flash Player is recommended for the
> default SDK in your version of Flash Builder should be the one to use when
> profiling.  Newer and older versions may report memory slightly differently
> and fool the profiler.
>
> HTH,
> -Alex
>
>
> On 2/5/13 5:57 AM, "Nigel Magnay" <nigel.mag...@gmail.com> wrote:
>
>
>
>
>
>
> We have an application that is leaking memory. Sadly, trying to diagnose
> this with the flex profiler (4.6, 4.7) is proving to be a frustrating
> experience.
>
> I've picked on one object class to try and understand what is going on. We
> have a wizard-style dialog box with a sidebar control 'wizardlinks' which
> adds 'wizardlink' objects to it. Both are Spark group controls. The links
> are being added to the group with an 'addElement' call.
>
> The WizardLink instances are growing in memory and do not seem to be being
> released. I've pared them right down to try and eliminate possible
> listeners.
>
> If I immediately remove the link, Something still seems to hold on to it.
> If I view it in the profiler object view, it expands saying (1 Path) but
> won't describe what it is. Even more mysteriously - if I run with "Watch
> live memory data", I can see the instances going up -- but if I then do a
> memory dump, those instances are now missing. If I don't run with 'watch
> live memory data', they are there.
>
> Part of this feels like chasing shadows - are these real leaks, or just
> things the collector will eventually get round to?
>
>
>
>
>
>
>
> --
> Alex Harui
> Flex SDK Team
> Adobe Systems, Inc.
> http://blogs.adobe.com/aharui
>
>  
>

Reply via email to