🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.lang.java
Article #20161

Eric.Sosman@Sun.COM <Eric.Sosman@Sun.COM> ����

#20161
From: tHeCuRe
Date: Tue, 23 Dec 2003 05:42
26 lines
1930 bytes
Araxes Tharsis wrote:
>
> When I create an object only with:
>     new MyJFrame();
> when will this object be Garbage Collected, as I have no explicit reference
> to it?!
    The object becomes eligible for collection immediately,
but there is no guarantee of exactly when the collection will
occur.  There is not even a guarantee that collection will occur
at all: if your program never runs short of memory, the JVM may
simply allow the garbage to hang around indefinitely.
> This is what is generally done in Swing, and I don't understand very well
> what goes on with GC (the object is not gc because the frame stays visible
> indefinitely...).
    Please provide more detail on what you think "is generally
done in Swing."  As far as I know, the JFrame will not become
visible until you call its setVisible() method -- for which you
need to have a reference to the JFrame.  Once the JFrame has
been made visible, Swing keeps its own internal references to
it even if you discard your own.
--
Eric.Sosman@sun.com
--

Life is life.
�� ��Դ:���Ұ��Ͽ�վ bbs.nankai.edu.cn��[FROM: 202.113.25.3] 
Technical Details
Message-ID: <49kYJI$9WI@bbs.nankai.edu.cn>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!fr.ip.ndsoftware.net!newsfeed.wirehub.nl!news.cambrium.nl!news.cambrium.nl!news.cambrium.nl!news2.euro.net!newshosting.com!news-xfer1.atl.newshosting.com!feed2.newsreader.com!newsreader.com!maily.cic.tsinghua.edu.cn!news.happynet.org!NanKai

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f6cb0,a710682b46885ada,start
X-Google-Attributes: gidf6cb0,public
X-Google-ArrivalTime: 2003-12-22 21:43:12 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!fr.ip.ndsoftware.net!newsfeed.wirehub.nl!news.cambrium.nl!news.cambrium.nl!news.cambrium.nl!news2.euro.net!newshosting.com!news-xfer1.atl.newshosting.com!feed2.newsreader.com!newsreader.com!maily.cic.tsinghua.edu.cn!news.happynet.org!NanKai
From: hoopdream.bbs@bbs.nankai.edu.cn (tHeCuRe)
Newsgroups: cn.bbs.comp.lang.java
Subject: Eric.Sosman@Sun.COM <Eric.Sosman@Sun.COM> ����
Date: 23 Dec 2003 05:42:06 GMT
Organization: �Ұ��Ͽ�վ
Message-ID: <49kYJI$9WI@bbs.nankai.edu.cn>
X-Filename: Java/M.1072158114.A
Lines: 26