Garbage Collection Problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Garbage Collection Problem

Brian Raymes

Hi all,

 

I’m having an issue that I can’t seem to wrap my head around related to the lack of garbage collection.

 

I have a status screen that displays a somewhat complicated list of items in a DataContainer.

 

When this screen is viewed, it polls the backend (every second) for an updated list of data that is converted into an ArrayListView and bound to a DataContainer with a custom renderer.

 

The view updates exactly as expected, but the problem is, the application memory footprint grows very fast (several MB per second), and never seems to perform any garbage collection what-so-ever. Even when I stop the polling.

 

As for code, here is a small snippet. It’s fairly simple.

 

            private function onFindAllAgents(event:ResultEvent):void

            {

                agents = new ArrayListView(event.result as ArrayList);

                agents.sort = new Sort([new SortField("sortLevel"falsefalsetrue)]);

                agents.refresh();

            }

 

 

                <j:DataContainer width="100%"

                    dataProvider="{agents}"

                    itemRenderer="com.teo.view.acdsupervisor.renderers.AgentItemRenderer">

 

                    <j:beads>

                        <j:RemoveAllItemRendererForArrayListData />

                        <js:CollectionChangeUpdateForArrayListData />

                        <!-- <j:RemoveAllItemRendererForArrayListData />

                        <js:DynamicAddItemRendererForArrayListData />

                        <js:DynamicRemoveItemRendererForArrayListData />

                        <js:DynamicUpdateItemRendererForArrayListData />

                        <js:DynamicRemoveAllItemRendererForArrayListData /> -->

                    </j:beads>

 

                </j:DataContainer>

 

As you can see, I’ve been playing around with other beads, but I’m quite sure what they do, or if they are even necessary. CollectionChangeUpdateForArrayListData  is necessary for ArrayListView (probably should be renamed…), but I don’t understand the others.

 

Is there something I am missing?

 

Any help will be greatly appreciated!

 

Brian

Reply | Threaded
Open this post in threaded view
|

Re: Garbage Collection Problem

Carlos Rovira-2
Hi Brian,

The "RemoveAllItemRendererForArrayListData" is a bead in charge of the removal of all renderers when use "removeAll()" method. So if you don't plan to do a removeAll, you can remove it. In early days each method (add, remove, removeAll and update) was in a bead, but removeAll never was refactored since it is not used always.

The rest commented can be removed since are for Basic version, Jewel will not use it (But you already have commented).

Regarding your problem. It's clear that there's a memory leak, and some listeners are hanging, so the items you remove are still there, and you're creating new ones. To locate the source of the problem you change temporarily to a basic renderer, to see if the problem persists. If that's the case, the problem will be in some of the components in Jewel or Basic in place. If not, the problem will be in your custom renderer. Another thing to try is to avoid in your test ArrayListView and go with ArrayList to see if the ALV can be the cause of the problem. As well check if the use of "CollectionChangeUpdateForArrayListData" with ArrayListView, if that's completely compatible or we need to do a new one for the later.

IOW, in these kinds of situations try to reduce to the most basic case where the problem does not appear and grow up until you get the problem again to localize the source of the problem.

HTH


El sáb, 6 feb 2021 a las 3:34, Brian Raymes (<[hidden email]>) escribió:

Hi all,

 

I’m having an issue that I can’t seem to wrap my head around related to the lack of garbage collection.

 

I have a status screen that displays a somewhat complicated list of items in a DataContainer.

 

When this screen is viewed, it polls the backend (every second) for an updated list of data that is converted into an ArrayListView and bound to a DataContainer with a custom renderer.

 

The view updates exactly as expected, but the problem is, the application memory footprint grows very fast (several MB per second), and never seems to perform any garbage collection what-so-ever. Even when I stop the polling.

 

As for code, here is a small snippet. It’s fairly simple.

 

            private function onFindAllAgents(event:ResultEvent):void

            {

                agents = new ArrayListView(event.result as ArrayList);

                agents.sort = new Sort([new SortField("sortLevel"falsefalsetrue)]);

                agents.refresh();

            }

 

 

                <j:DataContainer width="100%"

                    dataProvider="{agents}"

                    itemRenderer="com.teo.view.acdsupervisor.renderers.AgentItemRenderer">

 

                    <j:beads>

                        <j:RemoveAllItemRendererForArrayListData />

                        <js:CollectionChangeUpdateForArrayListData />

                        <!-- <j:RemoveAllItemRendererForArrayListData />

                        <js:DynamicAddItemRendererForArrayListData />

                        <js:DynamicRemoveItemRendererForArrayListData />

                        <js:DynamicUpdateItemRendererForArrayListData />

                        <js:DynamicRemoveAllItemRendererForArrayListData /> -->

                    </j:beads>

 

                </j:DataContainer>

 

As you can see, I’ve been playing around with other beads, but I’m quite sure what they do, or if they are even necessary. CollectionChangeUpdateForArrayListData  is necessary for ArrayListView (probably should be renamed…), but I don’t understand the others.

 

Is there something I am missing?

 

Any help will be greatly appreciated!

 

Brian



--
Carlos Rovira
Apache Member & Apache Royale PMC
Apache Software Foundation