• Post Reply Bookmark Topic Watch Topic
  • New Topic

Where objects are being stored . Cache or Disk ?  RSS feed

 
Arunabh Dash
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
Where objects are being stored ? I know it's heap . But i am really confuse whether it is Cache or Disk . I know heap is for persistance storage .Does that mean it's Disk . Sorry to ask such stupid question .But still ... it's Cache or Disk ? I will be grateful if i can get a quick reply .
With regareds
Arunabh
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an advanced question. Moving...
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm not sure, but i think the answer is both. i think it depends on the OS, but if stuff has been hanging around in the cache for a while unaccessed, it may be moved to the disk. the cache is then recovered for stuff that is being activly used.

Why do you need to know?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Arunabh Dash:
I know heap is for persistance storage.


This sounds wrong to me. The heap only lives as long as the JVM lives. When the JVM terminates, everything on the heap is lost - it is *not* persisted.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It also depends on which cache you are talking about. There is no particular cache being kept by the JVM - all objects that are not eligible for garbage collection will be kept in memory (I'm ignoring the java.lang.ref package and virtual memory here, because I don't think that's what you're asking about).

So a cache is something the application code builds, and while its point would ususally be to access data quickly in memory, in some cases cache information might be kept on disk. It really depends on what the cache is used for, and how hard it would be to recreate the data it contains.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The heap is just in the main working memory (RAM, random access memory) of your computer. It is not for persistent storage.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!