I'm making a photo browser. I load 15 photos as Images and add these Images to HGroup every time. When user presses 'next page', I first unload the existing Images by 'Image.unloadAndStop()' and 'Image.source=nu开发者_开发百科ll', and then load new photos. However, it seems that the GC never works. The task monitor shows that the memory use of my AIR reaches as much as 1.2G! Some people said it's a bug of Image when you load a picture larger than 1.5M. Is it true? Can I solve this problem?
Thanks!
In the past I have found orphaned listeners to be the culprit. Any listener still tied to the asset will render the asset non-GC-able. Make sure your cleanup method removes all listeners bound to the images. Just a guess.
Have you tried bitMap.dispose() as you remove the images? I believe this offers the bitmap for GC.
精彩评论