Wednesday, July 21, 2010

Flex: AdvancedDataGrid - Memory Leak

There is known memory leak issue with AdvancedDataGrid. It happens, when we have instance of AdvancedDataGrid loaded with some data and want to update it with newly received data and recreating columns in it. Found workaround is next - create new class, which extends and use it in your code. Add next method to it:

public function clearRenderers():void {
   this.itemRendererToFactoryMap = new Dictionary(false);
   this.visibleData = new Object();
   this.listData = null;
}


Call clearRenderers() method before setting new columns. It will fix memory leak completely.

2 comments: