• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

4 types of memory inside JVM

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

can any one know what are the four types of memory in JVM?

I guess stack,heap,permgen and native space are the four types but not sure.

If any one know could you explain the use of permgen and native space briefly.


Thanks in advance,
Dhaya
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh you are in luck. I just learn this today in my Java class. Technically speaking it's not memory inside JVM but really how are memory categorized? And such organization somehow affect the time to run GC.

PermGen, Old, Young (Eden+S1+S2) are the types of memory. S1 and S2 are called the "survivors". From what I understand, Eden space is the most active, copying objects to/fro S1 or S2. As app run/time progress such objects may go to old. PermGen space is really permanent/immutable objects like strings.

By the way, stack and heap are like cache. If you include these ... well count

PS if you run JConsole and click memory you should see the different types of memory you can monitor
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are no official "four types of memory" in the JVM. If you're taking a class, and the textbook or the instructor says there are four, then you'd best memorize whatever they say and repeat it when the test comes around. But if you walk into a job interview and the interviewer says "what are the four types of memory in the JVM?" then "mu" is the only acceptable answer -- or turning on your heel and running away.

K. Tsang's "types" are subdivisions of the heap used by the garbage collector; the stack is outside the heap. Don't even know what "like cache" is supposed to mean.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I always thought the cache was very fast memory on the chip; data loaded from RAM are stored in cache just before being processed, and data just processed are stored in the cache before going back to RAM or a disc. n which case the cache is not at all like the stack or heap.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic