I know that local variables and paramters of methods live in stack, but I not able to figure out where does actually methods live in case of Java?
If I declare any T
The heap is split up into multiple generations.
The bytecode, and its corrosponding JIT compiled machine code lives in the so called permanent generation, along with interned Strings and other class data.
Even though it is called the "permanent" generation, it can still be garbage collected. Some libraries, frameworks and JVM languages generate bytecode at run-time, so the permanent generation sometimes need clean up. Just like the other generations of the heap, but (one usually hopes) less frequently.