Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage collection

 
Pratik Goswami
Ranch Hand
Posts: 136
Android Chrome Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks
Pratik Goswami
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a forum devoted to Android
http://www.coderanch.com/forums/f-93/Android
 
Rob Spoor
Sheriff
Pie
Posts: 20550
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which is where I will move this thread.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you might also find this exercise interesting: Determine when Android GC runs
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic