Hi Wesley,

We work with ADG's extensively including some intense custom renderers and have had horrible problems with memory leaks. Turns out, there are known problems with the ADG's internal renderers leaking like a sieve. And as an experiment, we setup a custom renderer that simply returned .this and it leaked like crazy. We have a fairly large ADG (100+ columns) and every time we'd scroll right to see more columns, more renderers would be created in addition to the one's already present...and scrolling back left would recreate them again instead of using the one's that had already been created...at one point, we had several hundred instances of renderers running for a single grid. Insanity! And, because the ADG and the DG are maintained by two separate teams at Adobe, one is not related to the other and in this case, the DG does not have the same leaks as the ADG.

In the end, we had to write a serious piece of code to manage our renderers, which finally rid us of the leaks we were encountering. I've been working on trying to encapsulate our logic so I can post it here as I know a lot of other folks have run into the same problems and could probably use the help.

Best,
Adrian

Wesley Acheson wrote:

I've wasted most of the day trying to figure out why my application was leaking memory.

I was dynamically adding and removing columns from the AdvancedDataGrid. I noticed that it was slowing down a lot. I naturally assumed that it was my custom item renderer and even after reading Alex's blog entry about using the profiler I couldn't figure out what was holding references to my item renderer.

Anyway the error continued to happen after I commented out all the code in my item renderer. I even changed it to subclass AdvancedDataGridItemRenderer, still no joy. So I removed the custom item renderer and noticed that instead of my ItemRenderer the ADG didn't remove references to its own item renderer.

Anyway I changed to a standard DataGrid and all worked correctly. The references were removed when garbage collection occurred I had to change my code a bit.

This isn't really a question more of a complaint really. I don't know if it was my code or just a problem with the ADG though I suspect the latter.

A couple of things I noticed with the standard DG. Firstly if setting the itemrenderer on the DG itself it also uses the same ItemRenderer on the header rows. Is this correct behaviour. Setting the ItemRenderer on the column seems to keep the normal header renderer. This I admit has me confused is this the way its supposed to work? How would I set all the cells to a custom IR and leave the headers alone? It seems inconsistent.

I have read the excellent Articles on Alex's blog.

Anyway that's all.

Regards,

Wes


Reply via email to