You can look at the allocation stack trace to see where those come from.  
WeakMethodClosures can generate false-postives in the profiler so it may just 
be a false alarm.  I don't know why you would need to hook UI or input events 
directly to do vertical scroll positioning.  The secondary view should pull its 
viewstate from a central data model, then you don't need to push information 
into the view and worry about when it is ready.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of Manu Dhanda
Sent: Monday, February 09, 2009 11:01 PM
To: [email protected]
Subject: RE: [flexcoders] DataGrid updateComplete causes lots of memory leak.


Selection is fine, as you said, can be done easily.
But I do need UI and event framework for the vertical scroll positioning.

On the other hand, from the profiler, here I do have some interesting
figures:

Memory Snapshot(in couple of minutes interval)
Loitering Objects

WeakMethodClosure | flash.events | Instances:48914(98.43%) |
Memory:782624(83.87%) //with updateComplete

WeakMethodClosure | flash.events | Instances:2(2.25%) | Memory:32(0.23%)
//without updateComplete

Same steps being followed for two parallel instances of same app run and it
returned me above noticeable figures. A couple more lines were there(with
more objects), but this one is noticeable.

-Manu.

Alex Harui wrote:
>
> It occurs to me that if you're changing the display in updateComplete you
> could be causing another updateComplete and looping forever. Set a
> breakpoint on your handler and see how often it gets called.
>
> If I were doing something like this, I'd have a "currentSelection"
> property somewhere that the first DG sets and the second DG reacts to by
> binding to it and avoid using UI and validation events directly.
>
> Alex Harui
> Flex SDK Developer
> Adobe Systems Inc.<http://www.adobe.com/>
> Blog: http://blogs.adobe.com/aharui
>
> From: [email protected]<mailto:flexcoders%40yahoogroups.com> 
> [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com>] On
> Behalf Of Alex Harui
> Sent: Monday, February 09, 2009 10:15 PM
> To: [email protected]<mailto:flexcoders%40yahoogroups.com>
> Subject: RE: [flexcoders] DataGrid updateComplete causes lots of memory
> leak.
>
> Are you saying that afterwards the memory number does not drop back down
> even after you force a garbage collection using the profiler?
>
> If so, use the profiler to see what objects are sticking around. There's
> a tutorial on how to use it on my blog.
>
> Alex Harui
> Flex SDK Developer
> Adobe Systems Inc.<http://www.adobe.com/>
> Blog: http://blogs.adobe.com/aharui
>
> From: [email protected]<mailto:flexcoders%40yahoogroups.com> 
> [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com>] On
> Behalf Of Manu Dhanda
> Sent: Monday, February 09, 2009 10:07 PM
> To: [email protected]<mailto:flexcoders%40yahoogroups.com>
> Subject: RE: [flexcoders] DataGrid updateComplete causes lots of memory
> leak.
>
>
> Yes, am using the same line of code.
> updateComplete=this.callLater(setVerticalPosition);
>
> private function setVerticalPosition():void{
> productsGrid.verticalScrollPosition =
> getVerScrollPos(productsGrid.selectedItems);//which returns an int.
> }
>
> Now when I use profiler to see the memory use. The bar depicting the
> memory
> use keep on going up, drops all of a sudden then again goes up to a new
> high
> and so on(repeat the same criteria), until user actually switch his view
> to
> the screen having that datagrid. After that it will become a straight
> parallel line.
>
> WhereAs if I remove this one line of code, i.e. updateComplete(...) it
> achieves that straight parallel line much before and you don't even need
> to
> go to that particular view/screen.
>
> Any workaround or any other solution would be great.
>
> Thanks,
> Manu.
>
> Alex Harui wrote:
>>
>> Hopefully your code is:
>> updateComplete=this.callLater(setVerticalScrollBarMethod);
>>
>> Depending on what that code does, it might use a bunch of memory, but if
>> it gets freed later, it isn't a leak. The profiler will help you
>> determine if there really is a leak.
>>
>> Alex Harui
>> Flex SDK Developer
>> Adobe Systems Inc.<http://www.adobe.com/>
>> Blog: http://blogs.adobe.com/aharui
>>
>> From: 
>> [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>
>> [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>]
>> On
>> Behalf Of Manu Dhanda
>> Sent: Monday, February 09, 2009 8:21 PM
>> To: 
>> [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>
>> Subject: [flexcoders] DataGrid updateComplete causes lots of memory leak.
>>
>>
>> Hi Guyz,
>> I have a viewstack holding two DG's. When I double click on an item in
>> first
>> DG, it should switch to the second DG and select the corresponding item
>> in
>> that DG and scroll down to that item.
>>
>> If I set verticalscrollbarposition something like..
>> updateComplete=this.callLater(setVerticalScrollBarMethod());
>>
>> It causes a lot of memory leak until unless it is switched to the final
>> view(2nd DG with highlighted item.)
>> Can anyone tell me what I can use as an alternative to updateComplete ??
>>
>> -Manu.
>> --
>> View this message in context:
>> http://www.nabble.com/DataGrid-updateComplete-causes-lots-of-memory-leak.-tp21927484p21927484.html
>> Sent from the FlexCoders mailing list archive at Nabble.com.
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/DataGrid-updateComplete-causes-lots-of-memory-leak.-tp21927484p21928252.html
> Sent from the FlexCoders mailing list archive at Nabble.com.
>
>
>

--
View this message in context: 
http://www.nabble.com/DataGrid-updateComplete-causes-lots-of-memory-leak.-tp21927484p21928674.html
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to