Does disposing a JFrame cause memory leakage?

后端 未结 3 1287
一向
一向 2021-01-02 14:41

I am writing a test program as follows:

  1. When a user clicks button A, it opens 50 JFrames.
  2. When the user clicks button B it disposes all JFrames shown
3条回答
  •  -上瘾入骨i
    2021-01-02 15:23

    Without any code we can't help you much... are you calling jFrame.dispose()?

    public void dispose()

    Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. That is, the resources for these Components will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable.

    More information available here

提交回复
热议问题