Where does the Static members reside in memory,is it permanent generation?

This question already has an answer here:

  • Where are static methods and static variables stored in Java? 7 answers

  • static members : permanent generation(heap)

    local variable : stack memory which is not heap. refer here http://tutorials.jenkov.com/java-concurrency/java-memory-model.html


    It depends on the Java version you are using:

  • Pre Java8: statics (just like other "permanent" things) were stored in a PermGen . It's simply part of the memory model like young gen and old gen.
  • Java8: here PermGen got removed! For a number of reasons, for instance it was hard to tune it. Of course all the data didn't just got abandoned, since we still need it. It was just moved to Metaspace , which resides inside native memory (so outside Java heap).
  • 链接地址: http://www.djcxy.com/p/14548.html

    上一篇: DVM中的永久代

    下一篇: 静态成员在内存中的位置是永久生成的吗?