Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
821 views
in Technique[技术] by (71.8m points)

android - Bitmap memory leaks

So, before honeycomb, the Bitmap obeject was just a pointer for a native heap memory space( using malloc ), and i could clean that native memory calling .recycle() ; after honeycomb the memory for the Bitmap is allocated in the app heap, which gets gc calls.

My question is, my app need to support 2.2+ so what should I do? Check the version and call recyle? Dont call recycle at all? What is your advice for that. Because i have a BitmapCache which hold some Bitmap instances and i dont want them living in the memory for ever.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In any android version whether it is froyo,gingerbread or honeycomb. You have to check yourself for memory management. Yes, from 2.2+ you can adjust you application from sdcard, but keeping the bitmaps in heap memory, always will create problem for whether you use either version. If you want pure using of bitmaps, then why dont you follow their way, try this link. They have given you many ways to managing the bitmaps efficiently. Follow this link: Displaying bitmaps efficiently


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...