Static members where does they reside. i need an detail explanation of static ,local and instance members memory allocation(variables,methods). Memory management(Is it permanent generation).
Where does the Static members reside in memory,is it permanent generation?
256 Views Asked by Vinay S Jain At
2
There are 2 best solutions below
0

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).
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