1

I just wanted to know behavior difference between garbage collector in Android and garbage collector Java.

Also, detail behavior of both garbage collectors.

Bhaskar
  • 911
  • 6
  • 18
  • This is way too broad a question. There are have been many Java GCs, and with recent releases the JVM supports multiple GCs. (And Java ME collectors are different again.) Then the GCs for different versions of Android won't be the same either. And on top of that, there are a myriad of differences ... or none at all ... depending on what *perspective* you are taking. – Stephen C Apr 03 '14 at 11:52
  • Thank you Stephen. I want to know type of gc used in android. Official Gingerbread document says they have added Concurrent garbage collector — The Dalivik VM introduces a new, concurrent garbage collector that minimizes application pauses, helping to ensure smoother animation and increased responsiveness in games and similar applications. – Bhaskar Apr 03 '14 at 12:04
  • @StephenC: Sure, there are many JVM GCs, but IMHO the question isn't too broad. Assuming the OP is familiar with some JVM GC, what do they need to know about Android GC? – maaartinus Apr 03 '14 at 12:09
  • @maaartinus - OK. So >>you<< answer it!! I know a lot about GCs, and I can tell you that this question would require a 5 page answer. (And a couple of hours research.) And that is assuming that the OP already knows a lot about GCs ... for which, I see no evidence. – Stephen C Apr 03 '14 at 12:55
  • I think i should mention here that I'm newbie.. – Bhaskar Apr 03 '14 at 13:01
  • @Bhaskar - If you are really a newbie on Garbage Collection, I suggest that you start by reading the Wikipedia page on GC. http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29 – Stephen C Apr 03 '14 at 13:05
  • @StephenC: I can't answer it... I have some knowledge about a few JVM GCs, but know nothing about Android. And I guess there are a few points I could learn. Not 5 pages, just some basic differences would do. Could we agree that such a thing exists? I didn't want this question to be closed as too broad 'cause some overview with a few links can be useful to many Java programmers which happen to be Android dummies. – maaartinus Apr 03 '14 at 15:01

3 Answers3

3

Short answer: There is in fact a difference between garbage collectors in Java and Android.

The reason for that is, that Android does not use the "standard" JVM, it uses Dalvik VM.

You can read some more information about the concept of garbage collection in JVM here. Additionally I recommend the question Technical details of Android Garbage Collector to get some knowledge about the garbage collector concept in Android.

Community
  • 1
  • 1
trylimits
  • 2,575
  • 1
  • 22
  • 32
0

For the android see this

http://docs.xamarin.com/guides/android/advanced_topics/garbage_collection/

for java read this

http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html

i think it will may help u to understand about both

Bhanu Sharma
  • 5,135
  • 2
  • 24
  • 49
  • You are just talking about the *methods* used to "tell" the GC to run. I'm sure that is not what the OP is asking about. (And your first sentence makes no sense at all ...) – Stephen C Apr 03 '14 at 11:57
  • @StephenC now see my ans sir – Bhanu Sharma Apr 03 '14 at 12:01
  • This is still a poor Answer. A good answer consists of more than just links to other other pages. And besides, none of these explains the difference between Android and Java GCs. – Stephen C Apr 03 '14 at 12:51
  • @StephenC please give to your's sir i.e we all learn more about GC because i have only 2 year exp and i think on this question u r the senior of all so please give us a right direction and i requested to u to edit my ans and make more strong and more knowledgeable. please Sir – Bhanu Sharma Apr 03 '14 at 12:57
  • And the Xamarin link is not even relevant. Xamarin is a Mono (C#) port to the Android platform, not the Android / Davlik GC. Re your request - it would futile for me to attempt to answer a question this broad. – Stephen C Apr 03 '14 at 13:00
  • then i try my best if u have any suggestion then share – Bhanu Sharma Apr 03 '14 at 13:08
0

There is no difference. Both are same as Android uses Java. Also they work in the same way.

Check out this link for a detailed explanation on Java garbage collection's workflow.

fida1989
  • 3,234
  • 1
  • 27
  • 30