GC question.

by Jiri » Thu, 24 Sep 2009 21:59:05 GMT


Sponsored Links
 I have a simple question, in my ctivity i define a static private as so:

private final FileFetcher ff = new FileFetcher();

what happens when this activity is destroyed, is the reference to the 
FileFetcher completly gone, and can everything be marked for GC?

Or would it better to write

private FileFetcher ff;

and the in my onCreate instantiate the FileFetcher and nullify it in the 
onDestroy method?

Jiri

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



GC question.

by Felipe Silveira » Thu, 24 Sep 2009 22:17:09 GMT


 Hi Jiri,

Static references remains on memory until the process where your activity is
running is destroyed.

So, in order to avoid memory leaks, point the reference to null in
onDestroy()

Regards,

Felipe Silveira






-- 
Felipe Silveira
Engenharia da Computao
Universidade Federal de Itajub
 http://www.felipesilveira.com.br 
MSN: felipeuni...@hotmail.com
Skype: fsunifei
-------------------------------------------------

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


Sponsored Links


GC question.

by Mark Murphy » Thu, 24 Sep 2009 22:23:04 GMT


 Actually, the OP's example is final, not static.

Final references cannot be pointed to null, as they cannot be modified.
However, they are also not static, so they should be garbage collected
once the containing object (an activity in this case) itself is garbage
collected.




-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
Android App Developer Books:  http://commonsware.com/books.html 



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



GC question.

by Jiri » Fri, 25 Sep 2009 14:50:23 GMT


 Thank you both, that was what I needed to know.

J





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



Other Threads

1. Unable to format the incoming mail messages

Hi,

    I am a newbie in android, i am developing an app that reads the
mail from INBOX using java mail api and display it. Reading mail was
successful, but further displaying those html messages or images is
what i am unable to complete it.

   Please any body help me in this....What View i should choose in
showing the email messages?.

-- 

2. BBM di Android & iOS

http://gpgo.in/OiBBM di Android & iOS
Posted on Mar 03, 2011
Share <http://blackberry.gopego.com/full/2011/03/bbm-di-android-ios/#>
Share<http://www.facebook.com/sharer.php?u=http%3A%2F%2Fblackberry.gopego.com%2Ffull%2F2011%2F03%2Fbbm-di-android-ios&t=Gopego.com%20-%20BBM%20di%20Android%20%26%20iOS&src=sp>
Shortened URL: http://gpgo.in/Oi

[image: BBM di Android & iOS] <http://blackberry.gopego.com/>

Situs BGR belajar dari berbagai sumber terpercaya bahwa RIM berencana
membawa aplikasi BBM dan servisnya ke Android, bahkan iOS. Menurut beberapa
sumber, RIM belum menyelesaikan detail tentang kapan akan rilis dan berapa
harga servisnya. Tapi, kemungkinan aplikasi BBM akan dilepas bebas alias
gratis buat semua user.

Segala kemungkinan dapat terjadi. RIM bisa meminta fee sekali untuk servis
seterusnya atau meminta pihak ketiga mengatur soal harga untuk layanan BBM.

Agak aneh mengingat BBM demikian menyatu dengan device BlackBerry kreasi
RIM. Eksklusivitas yang akan segera hilang? Mungkin saja. RIM sepertinya
frustrasi dengan apa yang dilakukan WhatsApp dan Kik Messenger. Dua aplikasi
instant messaging itu mirip dengan konsep BBM yang diciptakan RIM.

User Android dan iOs silakan berharap-harap cemas. RIM sepertinya akan
mengurangi feature kalau benar BBM akan keluar kandang. Untuk membedakan
dengan BBM di handheld RIM, user Android dan iOS hanya bisa chatting tanpa
dapat berbagi foto, lokasi atau video. Feature terakhir tengah dikembangkan
RIM. Kalau ingin menggunakan layanan BBM secara penuh harus menggunakan
handheld RIM.

Di lain pihak, RIM dapat meraup ribuan user baru BBM di berbagai platform
smartphone. Pengalaman chatting dengan BBM bukan di device RIM tentu sangat
menggoda para penggila gadget.

Android bisa jadi sebuah kemungkinan besar. RIM memilih mobile OS Google
karena RIM mudah mengembangkan dan mengintegrasikan BBM dengan open
platform. Rencana RIM adalah melepas BBM ke Android berbarengan dengan
merilis aplikasi itu untuk iOS milik Apple.
Follow us on twitter @gopegodotcom

-- 

-- 



----------------------------
@yopiesuryadi
www.gopego.com
http://about.me/yopie

-- 
===============

3. JAPRI FYI : SPB Mobile Shell 5.

4. @override question

5. How to install package without asking user just like market app?

6. Communicating with the browser

7. Getting users phone speeds for automatic settings