• Post Reply Bookmark Topic Watch Topic
  • New Topic

Garbage Collector queries  RSS feed

 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Normally , it is said that JVM Memory layout [ Java heap space structure] consist of Heap space which is divided into difference generations - Young, Old, tenured etc.

G1 garbage collector (in Java 7 and above) does not entertain the concept of Young and Old generations . G1 divides heap space into multiple equal sized small heap space. Then it apply its logic to execute GC on these multiple equal sized heap spaces.

1. So can I say that if I enable G1 garbage collector for my application, Heap do NOT contain any Young, Old kind of generations , it only contains multiple equal sized heap spaces ?
2. Also , is JVM Memory layout [ Java heap space structure] is dependent on type of Collectors we choose (G1, CMS, Parallel GC) ?
3. Suppose if we do not specify any Garbage collector for my application, then, which Garbage collector is chosen as default garbage collection by Java ?

 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhay Agarwal wrote:...So can I say that if I enable G1 garbage collector for my application, Heap do NOT contain any Young, Old kind of generations , it only contains multiple equal sized heap spaces ?

Well, if you've read it, then it must be true...

2. Also , is JVM Memory layout [ Java heap space structure] is dependent on type of Collectors we choose (G1, CMS, Parallel GC) ?

I'm not quite sure why you think you need to know this. If it's for an exam question, then I suspect that what you need to do is read the course material and answer as they've "told" you.

However, I doubt whether there's any definitive answer to the question, since it's highly likely to depend on what version (or brand) of JVM you're running.

3. Suppose if we do not specify any Garbage collector for my application, then, which Garbage collector is chosen as default garbage collection by Java ?

Simple answer: Dunno. My most recent foray into that stuff suggested that it's a "clean-and-sweep" style, but if what you've read is right, there could be some newer paradigm.

The fact is: for you, as a Java programmer, it doesn't matter.

Winston
 
Campbell Ritchie
Marshal
Posts: 56581
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhay Agarwal wrote:Normally , it is said that JVM Memory layout [ Java heap space structure] consist of Heap space which is divided into difference generations - Young, Old, tenured etc.

G1 garbage collector (in Java 7 and above) does not entertain the concept of Young and Old generations . . . .
Another reason why it doesn't matter is that such things can change. As you noticed there.
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

thanks for all reply.
I was asking these question from interview perspective.
For example - If I am asked below mentioned questions in Interview, what should I answer

1. Also , is JVM Memory layout [ Java heap space structure] is dependent on type of Collectors we choose (G1, CMS, Parallel GC) ?
2. Suppose if we do not specify any Garbage collector for my application, then, which Garbage collector is chosen as default garbage collection by Java ?

 
Dave Tolls
Ranch Foreman
Posts: 3068
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think I've ever been asked anything bar the most cursory garbage collection question, and I've been in a lot of interviews.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!