Any way to avoid garbage collection on these lines? Bitmap.createBitmap / new Canvas(bitmap)

by Mark Murphy » Tue, 14 Apr 2009 22:12:18 GMT


Sponsored Links
 > I'm happy to keep a static or member reference to the Bitmap object




To me, the key word there is "many".

If really do mean "many", then cache the Bitmap (or perhaps the Canvas) in
a data member or local variable or something until you are outside your
loop and no longer need it. If at that point you are not expecting to
re-enter that loop for some time, null out the data member and let garbage
collection reclaim the space. If you are likely to re-enter the loop soon
and will need the exact same Bitmap again, you may as well hold onto it.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!



--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. News and Weather Standings: 11/16/2009

Since the demise of Cyrket and AndroidStats, I've been manually
keeping track of one category.

Standings for the top apps: (overall)

Weather Channel         2
Usa Today               28
WeatherBug              39
BBC News                42
AccuWeather             85
Cnn Mobile Web          109
NYTimes | Android       131
FOX News Widget         163
Le Parisien.fr - News   185
CNN News Widget         255
NubiNews - China        278
Japan Weather Radar     287
AP Mobile               291
tmz Mobile Web          316
ESPN News Widget        338
NewsRob                 342
Weather Widget          356
Express News            375
Radar Now               381
NubiNews - Japan        385
Moon Phase              396

--

2. Cannot start volume '/sdcard' (volume is not bound) error using vold

I have seen this problem in cupcake versions also where vold is involved.
Sdcard was  not an issue with mountd earlier.






> website: 

3. AppWidgetProvider SCREEN_ON/OFF Intent not received

4. Need help with XML parsing (SAX)

5. Thanks to Bro Wilber

6. Any examples of displaying an information box when clicked on a map marker ?

7. Any examples of displaying an information box when clicked on a map marker ?