Java interfaces… Dynamic or static memory?

后端 未结 3 1375
北恋
北恋 2021-01-19 15:10

Where do java interfaces reside in memory? Do they reside in the heap or the stack, or maybe global memory? I am thinking the are in the stack since they are created at comp

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-19 15:37

    Class definitions (including interfaces, etc) are stored on the heap (usually in the Permanent generation because their lifetime is long). If the ClassLoader that created them is garbage collected, they too are then eligible for garbage collection.

提交回复
热议问题