views:

152

answers:

3

I've got a flex component which works pretty well but unfortunately turns into a disaster once used in a datagroup item renderer of about 40-50 items.

Essentially it uses bitmapdata to take screenshot of a fully-rendered webpage in mx:HTML (this version of webkit rocks btw, miles better than flex 3).

The code is pretty self-explanatory I think.

http://noben.org/show/PageGrabber.mxml

I've optimized it all I could, browsed, search for answers and already trimmed it down a lot, I'm desparate to reduce the memory usage (about 600mb after 100 draw)

The Garbage collector has little effect.

Thanks! Nic

+1  A: 

would the event listeners be holding on due to strong referance? Try removing listeners or using weak references. See if it helps

shortstick
I doubt this would have such an effect. Still, worth knowing about and keeping track of.
spiralganglion
+1  A: 

Do you ever dispose of smallBMD? You might want to make sure they aren't accumulating in memory, lingering around after use, since you create a new one each time the passoire_completeHandler is called, without disposing the previous one (as far as I can see).

spiralganglion
+1  A: 

You need to call BitmapData.dispose() when you're done with them, you can't just chuck them away and hope they get collected. Sometimes they will, but often not :'(

Sophistifunk