Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

garbage collection

 
Akhil Gupta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are primitive datatypes also garbage collected or it is only objects, if no then do we free memory of primitives.
 
Bryan Timmins
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, garbage collection is performed on objects. I think the JVM deals with primitives behind the scenes.
 
Gurpreet Sachdeva
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Akhil,
The JVM allocates the memory to primitives when the object of the class having those primitives is created and that memory is de-allocated when that object is garbage collected.
Regards
Gurpreet Sachdeva
For any type of information regarding JCP exam(including mock exams) visit at: http://www.go4java.20m.com
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic