RE: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

2007-07-09 Thread James Booth
Are you using EventDispatcher at all?  If so, are you adding listeners at
each interval?  Make sure they're added and removed properly or they'll get
lost and mount up. It's hard to help without seeing any code.  Can you give
a brief example of the code that runs at each interval?

- James

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Varun
Soundararajan
Sent: Monday, July 09, 2007 2:51 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

Hi,
can anyone give some hints on how to proceed?

On 7/9/07, Varun Soundararajan <[EMAIL PROTECTED]> wrote:
>
> Hi Flash Champs,
>
>   I need help regarding handle leak issue. I have a Flash
> movie that parses XML from the server every 1 minute. The XML file that
the
> SWF parses in every 1 minute interval is around 100- 200 KB. I m seeing
that
> IE starts leaking handles (not sure if that is related to XML parsing, but
> the XML every one minute can trigger a change in the content of the movie
> (ie., what objects should be visible or if a new object needs to be
created
> etc) ).
>
>When I profiled IE process, I see a lot of "token" handle leaks
> (more than 2000 handles leaks per day) ( My understanding on Token
Handles:
> It is a handle to a security credential. Usually when IE connects to a
> server it tries to send the credentials of the logged in user. These
> credentials are seen as tokens in windows.)
>
>Are there any documented issues regarding this? If I keep IE
> open for a few days (2-3 days), Flash will cause IE to either crash, or
make
> the system unstable.. I have disabled all Toolbars (except Adobe PDF
> toolbar)..
>
> I use HTTP to request XML data from Server (I think thats the only
> non-remoting way to obtain data from server in Flash). There is JSP
Session
> ID based authentication to connect to server before running the SWF. Does
> that have something to do with this? When I login to the server with
> credentials, but dont launch the Flash movie, I dont have Handle Leaks,
that
> has led me to the conclusion that something in the flash movie could be
the
> trouble maker. How do I go ahead debugging? Thanks in advance.
>
>
> Some details about the Flash Movie:
> There are several Actionscript Verison 2 components in the movie all
> instances of which are created at runtime using actionscript. all of my
code
> is in Actionscript 2 There is quite some XML parsing. There are not much
> animations in the movie (the movie more has to do with parsing the XML and
> representing it in the screen). Please feel free to ask more details that
> are needed..
>
>
> Regards
> Varun
>



-- 
Regards
--Varun S
http://mailvarun.blogspot.com

/* This mail was sent using 100% recycled electrons */
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

2007-07-09 Thread Varun Soundararajan

Hi James,
you are right, I use a lot of EventDispatcher in the code. Most of the
components throw events which are listened by other components in the scene.
I have lot of components, more commonly, Tree, Scrollpanes, list box,etc
etc..

in my XML if I command the object to be deleted, it gets deleted.

If it were a movieclip in a scrollpane.
i do :
scrollpane.content.unloadMovie();
scrollpane.content.removeMovieClip();

and then i unload and remove the scrollpane itself.

if say, the XML commands the object to be created, i would also add
eventHandlers for the object I created.. eg:
object.addActionListener("enter",Delegate.create(this,enterActionHandler));

I dont remember adding a removeActionListener method when the object is
deleted (the deletion command is sent through the XML, which makes the VM to
delete the object)..I will do that ASAP and see how that helps..

This is a good lead.. Are there anything else associated with Action
Listeners/Event Dipatchers that I missed out?

One more thing, New listeners are NOT added to the existing object during 1
minute intervals,
I add listeners only when I create a new object, in other words, if the
server through the XML commands the client to create an object.

Is there some profiler that will help know if any event that was dispatched
has not been caught by any component/object?

Thanks
Varun

On 7/10/07, James Booth <[EMAIL PROTECTED]> wrote:


Are you using EventDispatcher at all?  If so, are you adding listeners at
each interval?  Make sure they're added and removed properly or they'll
get
lost and mount up. It's hard to help without seeing any code.  Can you
give
a brief example of the code that runs at each interval?

- James

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Varun
Soundararajan
Sent: Monday, July 09, 2007 2:51 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

Hi,
can anyone give some hints on how to proceed?

On 7/9/07, Varun Soundararajan <[EMAIL PROTECTED]> wrote:
>
> Hi Flash Champs,
>
>   I need help regarding handle leak issue. I have a Flash
> movie that parses XML from the server every 1 minute. The XML file that
the
> SWF parses in every 1 minute interval is around 100- 200 KB. I m seeing
that
> IE starts leaking handles (not sure if that is related to XML parsing,
but
> the XML every one minute can trigger a change in the content of the
movie
> (ie., what objects should be visible or if a new object needs to be
created
> etc) ).
>
>When I profiled IE process, I see a lot of "token" handle
leaks
> (more than 2000 handles leaks per day) ( My understanding on Token
Handles:
> It is a handle to a security credential. Usually when IE connects to a
> server it tries to send the credentials of the logged in user. These
> credentials are seen as tokens in windows.)
>
>Are there any documented issues regarding this? If I keep IE
> open for a few days (2-3 days), Flash will cause IE to either crash, or
make
> the system unstable.. I have disabled all Toolbars (except Adobe PDF
> toolbar)..
>
> I use HTTP to request XML data from Server (I think thats the only
> non-remoting way to obtain data from server in Flash). There is JSP
Session
> ID based authentication to connect to server before running the SWF.
Does
> that have something to do with this? When I login to the server with
> credentials, but dont launch the Flash movie, I dont have Handle Leaks,
that
> has led me to the conclusion that something in the flash movie could be
the
> trouble maker. How do I go ahead debugging? Thanks in advance.
>
>
> Some details about the Flash Movie:
> There are several Actionscript Verison 2 components in the movie all
> instances of which are created at runtime using actionscript. all of my
code
> is in Actionscript 2 There is quite some XML parsing. There are not much
> animations in the movie (the movie more has to do with parsing the XML
and
> representing it in the screen). Please feel free to ask more details
that
> are needed..
>
>
> Regards
> Varun
>



--
Regards
--Varun S
http://mailvarun.blogspot.com

/* This mail was sent using 100% recycled electrons */
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com





--
Regards
--Varun S
http://mailvarun.blogspot.com

/* This mail was sent using 10

RE: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

2007-07-10 Thread David Ngo
Removing the MovieClips or objects does not remove the listeners to that
object. You would have to explicitly remove the listeners first then remove
your MovieClip/object. Otherwise, the reference to the listener will still
exist, thus not get picked up by garbage collection. This could be another
cause of your leak issue.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Varun
Soundararajan
Sent: Tuesday, July 10, 2007 2:10 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

Hi James,
you are right, I use a lot of EventDispatcher in the code. Most of the
components throw events which are listened by other components in the scene.
I have lot of components, more commonly, Tree, Scrollpanes, list box,etc
etc..

in my XML if I command the object to be deleted, it gets deleted.

If it were a movieclip in a scrollpane.
i do :
scrollpane.content.unloadMovie();
scrollpane.content.removeMovieClip();

and then i unload and remove the scrollpane itself.

if say, the XML commands the object to be created, i would also add
eventHandlers for the object I created.. eg:
object.addActionListener("enter",Delegate.create(this,enterActionHandler));

I dont remember adding a removeActionListener method when the object is
deleted (the deletion command is sent through the XML, which makes the VM to
delete the object)..I will do that ASAP and see how that helps..

This is a good lead.. Are there anything else associated with Action
Listeners/Event Dipatchers that I missed out?

One more thing, New listeners are NOT added to the existing object during 1
minute intervals,
I add listeners only when I create a new object, in other words, if the
server through the XML commands the client to create an object.

Is there some profiler that will help know if any event that was dispatched
has not been caught by any component/object?

Thanks
Varun

On 7/10/07, James Booth <[EMAIL PROTECTED]> wrote:
>
> Are you using EventDispatcher at all?  If so, are you adding listeners at
> each interval?  Make sure they're added and removed properly or they'll
> get
> lost and mount up. It's hard to help without seeing any code.  Can you
> give
> a brief example of the code that runs at each interval?
>
> - James
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Varun
> Soundararajan
> Sent: Monday, July 09, 2007 2:51 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?
>
> Hi,
> can anyone give some hints on how to proceed?
>
> On 7/9/07, Varun Soundararajan <[EMAIL PROTECTED]> wrote:
> >
> > Hi Flash Champs,
> >
> >   I need help regarding handle leak issue. I have a Flash
> > movie that parses XML from the server every 1 minute. The XML file that
> the
> > SWF parses in every 1 minute interval is around 100- 200 KB. I m seeing
> that
> > IE starts leaking handles (not sure if that is related to XML parsing,
> but
> > the XML every one minute can trigger a change in the content of the
> movie
> > (ie., what objects should be visible or if a new object needs to be
> created
> > etc) ).
> >
> >When I profiled IE process, I see a lot of "token" handle
> leaks
> > (more than 2000 handles leaks per day) ( My understanding on Token
> Handles:
> > It is a handle to a security credential. Usually when IE connects to a
> > server it tries to send the credentials of the logged in user. These
> > credentials are seen as tokens in windows.)
> >
> >Are there any documented issues regarding this? If I keep IE
> > open for a few days (2-3 days), Flash will cause IE to either crash, or
> make
> > the system unstable.. I have disabled all Toolbars (except Adobe PDF
> > toolbar)..
> >
> > I use HTTP to request XML data from Server (I think thats the only
> > non-remoting way to obtain data from server in Flash). There is JSP
> Session
> > ID based authentication to connect to server before running the SWF.
> Does
> > that have something to do with this? When I login to the server with
> > credentials, but dont launch the Flash movie, I dont have Handle Leaks,
> that
> > has led me to the conclusion that something in the flash movie could be
> the
> > trouble maker. How do I go ahead debugging? Thanks in advance.
> >
> >
> > Some details about the Flash Movie:
> > There are several Actionscript Verison 2 components in the movie all
> > instances of which are created at runtime using actionscript. all of my
> code
> > is in Actionscript 2 There is quite some XM

RE: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

2007-07-10 Thread James Booth
Varun,

To make sure that any listener are properly removed and the way I usually
handle EventDispatcher, is to first create a private variable for the
delegate.

private var onStatus_func : Function;

Then in an init function or elsewhere prior to adding the listeners:

onStatus_func = Delegate.create (this, updateStatus);

then, adding the listener:

myClass.addEventListener ("onStatus", onStatus_func);

you would then remove it as:

myClass.removeEventListener ("onStatus", onStatus_func);

This is one of the few ways that will properly remove the eventListener.  I
tend to keep them in a destroy function to make it easy.

If you are throwing the delegate in as such:

myClass.addEventListener ("onStatus", Delegate.create (this, updateStatus));

myClass.removeEventListener ("onStatus", Delegate.create (this,
updateStatus));

This will not work. It's how the function is referenced.  I've done simple
tests with components to verify that it doesn't work.

Hope that helps.

- James

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Ngo
Sent: Tuesday, July 10, 2007 7:53 AM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

Removing the MovieClips or objects does not remove the listeners to that
object. You would have to explicitly remove the listeners first then remove
your MovieClip/object. Otherwise, the reference to the listener will still
exist, thus not get picked up by garbage collection. This could be another
cause of your leak issue.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Varun
Soundararajan
Sent: Tuesday, July 10, 2007 2:10 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

Hi James,
you are right, I use a lot of EventDispatcher in the code. Most of the
components throw events which are listened by other components in the scene.
I have lot of components, more commonly, Tree, Scrollpanes, list box,etc
etc..

in my XML if I command the object to be deleted, it gets deleted.

If it were a movieclip in a scrollpane.
i do :
scrollpane.content.unloadMovie();
scrollpane.content.removeMovieClip();

and then i unload and remove the scrollpane itself.

if say, the XML commands the object to be created, i would also add
eventHandlers for the object I created.. eg:
object.addActionListener("enter",Delegate.create(this,enterActionHandler));

I dont remember adding a removeActionListener method when the object is
deleted (the deletion command is sent through the XML, which makes the VM to
delete the object)..I will do that ASAP and see how that helps..

This is a good lead.. Are there anything else associated with Action
Listeners/Event Dipatchers that I missed out?

One more thing, New listeners are NOT added to the existing object during 1
minute intervals,
I add listeners only when I create a new object, in other words, if the
server through the XML commands the client to create an object.

Is there some profiler that will help know if any event that was dispatched
has not been caught by any component/object?

Thanks
Varun

On 7/10/07, James Booth <[EMAIL PROTECTED]> wrote:
>
> Are you using EventDispatcher at all?  If so, are you adding listeners at
> each interval?  Make sure they're added and removed properly or they'll
> get
> lost and mount up. It's hard to help without seeing any code.  Can you
> give
> a brief example of the code that runs at each interval?
>
> - James
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Varun
> Soundararajan
> Sent: Monday, July 09, 2007 2:51 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?
>
> Hi,
> can anyone give some hints on how to proceed?
>
> On 7/9/07, Varun Soundararajan <[EMAIL PROTECTED]> wrote:
> >
> > Hi Flash Champs,
> >
> >   I need help regarding handle leak issue. I have a Flash
> > movie that parses XML from the server every 1 minute. The XML file that
> the
> > SWF parses in every 1 minute interval is around 100- 200 KB. I m seeing
> that
> > IE starts leaking handles (not sure if that is related to XML parsing,
> but
> > the XML every one minute can trigger a change in the content of the
> movie
> > (ie., what objects should be visible or if a new object needs to be
> created
> > etc) ).
> >
> >When I profiled IE process, I see a lot of "token" handle
> leaks
> > (more than 2000 handles leaks per day) ( My understanding on Token
> Handles:
> > It is a handle to a security credential. Usually when IE connects to a
> > server i

Re: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

2007-07-10 Thread Varun Soundararajan

Hi James,
 Thanks a lot for pointing out the pitfall.. :-)..

-Varun

On 7/10/07, James Booth <[EMAIL PROTECTED]> wrote:


Varun,

To make sure that any listener are properly removed and the way I usually
handle EventDispatcher, is to first create a private variable for the
delegate.

private var onStatus_func : Function;

Then in an init function or elsewhere prior to adding the listeners:

onStatus_func = Delegate.create (this, updateStatus);

then, adding the listener:

myClass.addEventListener ("onStatus", onStatus_func);

you would then remove it as:

myClass.removeEventListener ("onStatus", onStatus_func);

This is one of the few ways that will properly remove the
eventListener.  I
tend to keep them in a destroy function to make it easy.

If you are throwing the delegate in as such:

myClass.addEventListener ("onStatus", Delegate.create (this,
updateStatus));

myClass.removeEventListener ("onStatus", Delegate.create (this,
updateStatus));

This will not work. It's how the function is referenced.  I've done simple
tests with components to verify that it doesn't work.

Hope that helps.

- James

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Ngo
Sent: Tuesday, July 10, 2007 7:53 AM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

Removing the MovieClips or objects does not remove the listeners to that
object. You would have to explicitly remove the listeners first then
remove
your MovieClip/object. Otherwise, the reference to the listener will still
exist, thus not get picked up by garbage collection. This could be another
cause of your leak issue.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Varun
Soundararajan
Sent: Tuesday, July 10, 2007 2:10 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?

Hi James,
you are right, I use a lot of EventDispatcher in the code. Most of the
components throw events which are listened by other components in the
scene.
I have lot of components, more commonly, Tree, Scrollpanes, list box,etc
etc..

in my XML if I command the object to be deleted, it gets deleted.

If it were a movieclip in a scrollpane.
i do :
scrollpane.content.unloadMovie();
scrollpane.content.removeMovieClip();

and then i unload and remove the scrollpane itself.

if say, the XML commands the object to be created, i would also add
eventHandlers for the object I created.. eg:
object.addActionListener("enter",Delegate.create
(this,enterActionHandler));

I dont remember adding a removeActionListener method when the object is
deleted (the deletion command is sent through the XML, which makes the VM
to
delete the object)..I will do that ASAP and see how that helps..

This is a good lead.. Are there anything else associated with Action
Listeners/Event Dipatchers that I missed out?

One more thing, New listeners are NOT added to the existing object during
1
minute intervals,
I add listeners only when I create a new object, in other words, if the
server through the XML commands the client to create an object.

Is there some profiler that will help know if any event that was
dispatched
has not been caught by any component/object?

Thanks
Varun

On 7/10/07, James Booth <[EMAIL PROTECTED]> wrote:
>
> Are you using EventDispatcher at all?  If so, are you adding listeners
at
> each interval?  Make sure they're added and removed properly or they'll
> get
> lost and mount up. It's hard to help without seeing any code.  Can you
> give
> a brief example of the code that runs at each interval?
>
> - James
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Varun
> Soundararajan
> Sent: Monday, July 09, 2007 2:51 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] Re: Handle Leaks in Flash, anyone can help?
>
> Hi,
> can anyone give some hints on how to proceed?
>
> On 7/9/07, Varun Soundararajan <[EMAIL PROTECTED]> wrote:
> >
> > Hi Flash Champs,
> >
> >   I need help regarding handle leak issue. I have a Flash
> > movie that parses XML from the server every 1 minute. The XML file
that
> the
> > SWF parses in every 1 minute interval is around 100- 200 KB. I m
seeing
> that
> > IE starts leaking handles (not sure if that is related to XML parsing,
> but
> > the XML every one minute can trigger a change in the content of the
> movie
> > (ie., what objects should be visible or if a new object needs to be
> created
> > etc) ).
> >
> >When I profiled IE process, I see a lot of "token" handle
> leaks
> > (more than 2000 handles leaks per day) ( My und