Memory leak with Data Grid and Item Renderers

View: New views
4 Messages — Rating Filter:   Alert me  

Memory leak with Data Grid and Item Renderers

by Nick Middleweek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I'm trying to track down a memory leak problem in an Advanced Data Grid.

On Creation Complete of the Application I'm loading the data:XML which is
bound to the dataProvider.

I'm then loading the columnConfig:XML and looping through it creating the
AdvancedDataGridColumns for the ADG.

N.B. All of the columns have a header and item Renderer.


It is possible to open a PopUp dialog and show/ hide more columns. When this
happens, the columnConfig:XML is modified to reflect the users new columns
and is sent to the server to save that config.

Then I'm looping back through the columnConfig:XML to rebuild the new Column
layout.

Using the Profile Manager I can see that more itemRenderers are being
created for each visible row in the ADG so in effect it's doubling up. Now
if I show/hide some different columns, I'm looping the columnConfig:Xml
again which in turn is creating more itemRenderers using more memory
(tripling up, etc)...


Is there a way I can destroy the itemRenderers before I rebuild the columns
to prevent the memory leak?


Thanks and ahave a great weekend!


Nick

Re: Memory leak with Data Grid and Item Renderers

by valdhor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't think you can do that. Item renderers are created automatically.

If it were me, I would probably removeAllChildren from the datagrid and add each column again. This should create new renderers as required.


--- In flexcoders@..., Nick Middleweek <nick@...> wrote:

>
> Hello,
>
> I'm trying to track down a memory leak problem in an Advanced Data Grid.
>
> On Creation Complete of the Application I'm loading the data:XML which is
> bound to the dataProvider.
>
> I'm then loading the columnConfig:XML and looping through it creating the
> AdvancedDataGridColumns for the ADG.
>
> N.B. All of the columns have a header and item Renderer.
>
>
> It is possible to open a PopUp dialog and show/ hide more columns. When this
> happens, the columnConfig:XML is modified to reflect the users new columns
> and is sent to the server to save that config.
>
> Then I'm looping back through the columnConfig:XML to rebuild the new Column
> layout.
>
> Using the Profile Manager I can see that more itemRenderers are being
> created for each visible row in the ADG so in effect it's doubling up. Now
> if I show/hide some different columns, I'm looping the columnConfig:Xml
> again which in turn is creating more itemRenderers using more memory
> (tripling up, etc)...
>
>
> Is there a way I can destroy the itemRenderers before I rebuild the columns
> to prevent the memory leak?
>
>
> Thanks and ahave a great weekend!
>
>
> Nick
>



Re: [Spam] Re: Memory leak with Data Grid and Item Renderers

by Nick Middleweek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

There doesn't seem to be a removeAllChildren() method of the Advanced Data
Grid.

Also, when I test test the numChildren property it only gives me 4 but I've
got a renderer (child) for each of the 9 columns over 20 rows = 180...

I've just found a rendererArray which is an Array of Arrays for the
renderers for each row/Column... I'm hoping I may be able to delete the
'children' this way? have you ever used this property?

or perhaps there's another way to delete the 'children' of the Adv Data
Grid?


Thanks,
Nick




2009/11/6 valdhor <valdhorlists@...>

>
>
> I don't think you can do that. Item renderers are created automatically.
>
> If it were me, I would probably removeAllChildren from the datagrid and add
> each column again. This should create new renderers as required.
>
>
>

[Spam] Re: Memory leak with Data Grid and Item Renderers

by valdhor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry, you are correct.

I believe you need to manipulate the columns array. This array holds an AdvancedDataGridColumn reference for each column. Set this to a new array containing the new columns.

--- In flexcoders@..., Nick Middleweek <nick@...> wrote:

>
> Hi,
>
> There doesn't seem to be a removeAllChildren() method of the Advanced Data
> Grid.
>
> Also, when I test test the numChildren property it only gives me 4 but I've
> got a renderer (child) for each of the 9 columns over 20 rows = 180...
>
> I've just found a rendererArray which is an Array of Arrays for the
> renderers for each row/Column... I'm hoping I may be able to delete the
> 'children' this way? have you ever used this property?
>
> or perhaps there's another way to delete the 'children' of the Adv Data
> Grid?
>
>
> Thanks,
> Nick
>
>
>
>
> 2009/11/6 valdhor <valdhorlists@...>
>
> >
> >
> > I don't think you can do that. Item renderers are created automatically.
> >
> > If it were me, I would probably removeAllChildren from the datagrid and add
> > each column again. This should create new renderers as required.
> >
> >
> >
>