Nate,

I am glad things seem to be working somewhat better and I can see 
the smoke effect taking major cpu time.

For future reference, removing a child does not remove the event 
listeners on that child. I might, for example, want to remove a 
child from one container and add it to another, so, the child is 
preserved until all references to it are removed.

Skim this link when you have time, start about half way down on 
destroying unused objects.

http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/ww
help.htm?context=LiveDocs_Book_Parts&file=performance_118_27.html

This might not have anything to do with your issue at this point, 
but, it is still very usefull information.

Take care,
Mike
http://blogs.digitalprimates.net/codeSlinger/



--- In [email protected], "Nate Pearson" 
<[EMAIL PROTECTED]> wrote:
>
> I am not removing any event listeners.  Here's how I am adding 
them.
>   
> endDate.addEventListener(MouseEvent.CLICK, barClick)
> 
> 
> private function barClick(event:MouseEvent):void{
>   var Event:TextEvent = new TextEvent("barClick");
>   var myDate:Date = new Date();
>   Event.text = myDate.getMilliseconds().toString();           
>   dispatchEvent(Event);
> }
> 
> I figured that when you remove a child that it would remove any 
event
> listeners that were on that child.  I wrote this in a loop through 
the
> children:
> 
> if (this.getChildAt(0).hasEventListener("MouseEvent.CLICK")){ 
> this.getChildAt(0).removeEventListener("MouseEvent.CLICK", 
barClick );
> }     
> 
> When I debugged that if statement was never true.  I also commented
> out all of my addEventListener code and the app still eats up 
memory. :(
> 
> Alex, I read your garbage collection and memory leak posts.  I
> automated changing my data providers and turning flex book pages.  
I
> got to 608 megs before there was heaving pagging and i stopped 
it.  It
> seems when I change dataproviders my app likes to take up a chunk 
of
> 10 megs of memory at a time.
> 
> When I automate Ely's Anatomy flex book on its own it takes up 
around
> 100k a second and doesn't seem to top out.  I wonder if this could
> have to do with his component?  I doubt it though, hes like a super
> genius and I'm new to AS3; so it's probably me.
> 
> I'm willing to try anything and everything to get this fixed!
> 
> Thanks for your response.
> 
> Nate  
> 
> 
> 
> --- In [email protected], "Michael Labriola"
> <labriola@> wrote:
> >
> > 
> > Nate,
> > 
> > Out of curiosity, you mention event listeners specifically. When 
you 
> > are removing children and changing dataProviders, are you also 
> > removing event listeners or do you just continue to add them.
> > 
> > Dependent upon how you are adding the event listeners, you could 
be 
> > preventing flash from garbage collection the previous 
dataproviders 
> > and/or the objects you are creating.
> > 
> > Just my first reaction,
> > Mike
> > http://blogs.digitalprimates.net/codeSlinger/
> > 
> > 
> > --- In [email protected], "Nate Pearson" 
> > <napearson99@> wrote:
> > >
> > > "Are you changing the entire dp or values inside it?"
> > > I have 4 dps each which hit its own instance of the 
component.  I 
> > am
> > > getting new data from a webservice and assigning it to the dps 
> > like so:
> > > p3.dataProvider = _Book[0].bar
> > > p4.dataProvider = _Book[0].bar  
> > > p2.dataProvider = _Book[1].bar
> > > p1.dataProvider = _Book[1].bar
> > > 
> > > *Book is an array collection that receives information from my 
ws
> > > 
> > > 
> > > "What kinds of custom component is it?"
> > > My custom component extends UIComponent.  I dynamically draw a 
few
> > > sprites, labels and text inside of it depending on the data.  
Each 
> > of
> > > those have an event handler on them.
> > > 
> > > Those components sit inside Ely's flex component as 
transparent 
> > pages.
> > >  The idea is to dynamically build layers based on what the 
user 
> > wants
> > > to see.  I have Doug Mccune's version of Ely's fish eye 
component 
> > as
> > > the navigation on the bottom.  After I change the dpa few 
times 
> > and my
> > > component gets updated i can really tell that the fish eye 
> > component
> > > slows down.
> > > 
> > > 
> > > "Is memory usage going up?"
> > > Memory usage does go up.  In firefox after changing the dp 
about 20
> > > times i pumped it up from 70megs to 220megs.  The browser also 
> > takes
> > > up exactly 22% or 25% of the cpu in IE and Firefox 
respectively.  
> > I'm
> > > on a dual core with hyper threading and I think its maxing out 
one 
> > of
> > > the fake cores.  The weird thing is that it stays at that 22% 
or 
> > 25%.
> > >   I have debugged for updatedisplaylist infinite loops but i 
didn't
> > > find one. 
> > > 
> > > 
> > > "What gets slower?  Scrolling? Something else?"
> > > Everything does.  I have some animations that go very slow.  
The 
> > fish
> > > eye component goes very slow.  Turning the page in the flex 
book is
> > > also slow.  It seems like the frame rate gets very low.  
Reminds 
> > me of
> > > in a video game when there is too much action going on and my 
> > computer
> > > slows down.
> > > 
> > > Sorry for the really long reply, but this component is so 
> > important to
> > > me!  I'm in on a Saturday trying to get it fixed :(.
> > > 
> > > Thank you Alex!
> > > 
> > > -Nate
> > > 
> > > p.s. I am also clearing this children along with graphics.clear
() 
> > in
> > > updatedisplaylist.
> > >           
> > > var j:int = this.numChildren
> > > for (i=0; i<j; i++){
> > > this.removeChildAt(0)
> > > }
> > > 
> > > 
> > > --- In [email protected], "Alex Harui" <aharui@> 
> > wrote:
> > > >
> > > > Are you changing the entire dp or values inside it?      
What 
> > kinds of
> > > > custom component is it?
> > > > 
> > > >  
> > > > 
> > > > ________________________________
> > > > 
> > > > From: [email protected]
> > > > [mailto:[EMAIL PROTECTED] On Behalf Of Nate 
Pearson
> > > > Sent: Friday, April 06, 2007 5:28 PM
> > > > To: [email protected]
> > > > Subject: [flexcomponents] changing dataprovider on custom 
> > component
> > > > 
> > > >  
> > > > 
> > > > I have a custom component that works pretty well. When I 
change 
> > the
> > > > dataProvider while the application is running it gets slower 
and
> > > > slower. The more I change it the worse it gets. 
> > > > 
> > > > In my updateDisplayList I call graphics.clear(); . Do i need 
to
> > > > override the dataprovider function and call graphics.clear
(); 
> > there? 
> > > > If so could someone show me how?
> > > > 
> > > > I also call invalidateDisplayList on my component(s) from my 
main
> > > > application. Im guessing this is bad practice and it should 
be 
> > called
> > > > some where inside (perhaps when I set the dataprovider?)
> > > > 
> > > > If not, what do you think is wrong?
> > > >
> > >
> >
>


Reply via email to