-2

Where is the definition of class stored in memory ?

Yacoby
  • 54,544
  • 15
  • 116
  • 120
Saurabh Gokhale
  • 53,625
  • 36
  • 139
  • 164
  • 4
    I suggest that before you ask any more questions, you browse through the JLS (http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html) and the JVM Spec (http://java.sun.com/docs/books/jvms/second_edition/html/Overview.doc.html). – Michael Myers Mar 21 '10 at 06:35
  • 8
    A class is like a computer science class that you are taking right now. One that you have homework assigned for. One that you will fail if you do not start learning the material instead of asking every question on the interwebs. – Kevin Crowell Mar 21 '10 at 06:37
  • Duplicate of http://stackoverflow.com/questions/2263523/does-java-have-automatic-garbage-collection – Stephen C Mar 21 '10 at 07:37
  • 1
    In the last hour you have asked 5 questions, all of them are voted -3 at least, do some research before posting your homeworks here – mohdajami Mar 21 '10 at 08:20

1 Answers1

1

It depends on which Java you're talking about

"the memory layout of run-time data areas, the garbage-collection algorithm used, and any internal optimization of the Java virtual machine instructions (for example, translating them into machine code) are left to the discretion of the implementor."

See the JVM spec.

That said, Sun Java has a section of memory called the permanent generation, which includes class definitions. Because of its original intent (a relatively small area for mostly static classes), the permanent generation doesn't always fit well with dynamic langauges targetting the JVM. See this discussion of JRuby issues. That is part of the motivation for the Da Vinci Machine project, which aims to improve VM support for such languages.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539