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).
Asked
Active
Viewed 243 times
2 Answers
1
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

Naz
- 390
- 1
- 4
- 15
-
This is not true for newest Java versions unfortunately – Mateusz Dymczyk Mar 18 '15 at 11:16
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).

Mateusz Dymczyk
- 14,969
- 10
- 59
- 94