This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Android and the fly likes Garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Garbage collection" Watch "Garbage collection" New topic

Garbage collection

Pratik Goswami
Ranch Hand

Joined: Mar 02, 2009
Posts: 136

Hello everyone!!

The common problems I have found for android is memory exception. Being a mobile application developer we have to be more conscious about memory usage for running apps. Is the Garbage collection based on Activity life cycle?

Pratik Goswami

iOS * Android Developer
Darryl Burke

Joined: May 03, 2008
Posts: 4523

There's a forum devoted to Android

luck, db
There are no new questions, but there may be new answers.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19651

Which is where I will move this thread.

How To Ask Questions How To Answer Questions
Monu Tripathi

Joined: Oct 12, 2008
Posts: 1369

Is the Garbage collection based on Activity life cycle?

I don't think Garbage collection is tied with Activity life cycle in particular. The collector itself(or its optimizing engine) is expected to determine the best time to perform a collection. It is based on the allocation being made; eventually GC will run.
For example, before getting an OutOfMemoryError, collection is guaranteed to have been performed once.

Instead of focusing on the times when the collection is done, try to keep Memory leaks in check and avoid creating objects where ever possible.

[List of FAQs] | [Android FAQ] | [Samuh Varta]
Monu Tripathi

Joined: Oct 12, 2008
Posts: 1369

I think you might also find this exercise interesting: Determine when Android GC runs
subject: Garbage collection
Similar Threads
Pool of Interns Memory(String literals)
mock q on garbage collection
wierd performance in tomcat/java: help consult
Memory Errors and Swing/AWT
How to force garbage collection in jdk 1.5