Static Variable Storage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akila15
    New Member
    • Feb 2007
    • 1

    #1

    Static Variable Storage

    Where are the static variable getting stored? Is it on heap .. or any other location?
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by akila15
    Where are the static variable getting stored? Is it on heap .. or any other location?
    Memory usage is implementation dependent and not part of the language. The stack and the heap are just imaginary places in memory. Both are dynamic.
    Everything that's declared static is dumped in a fixed size block of memory. Static variables do not need to be stored in dynamic data structures because their size is completely determined before execution and remains the same.

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      You can read the JVM specification for more information on this.

      Comment

      Working...