🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #559

Reference and Garbage Collection

#559
From: Vander
Date: Tue, 05 Jul 2005 05:57
39 lines
1874 bytes
I'm not quite sure about what kind of references to an object determine 
its "alive" quality and its readiness for garbage collection. For the 
moment I understand that *any* living reference, including non-explict 
of member classes, keep the object alive.

Would you agree that the follwoing class "NeverRelease" entails 
instances which will never get prone to garbage collection?

class NeverRelease
{
    Child1    child;

    public NeverRelease ()
    {
       child = new Child1();
    }

    private class Child1
    {
    }
}

While would you also agree that instances of the following class 
"AlwaysRelease" always become garbage because the member class is static 
and hence does not take reference to the enclosing class?

class AlwaysRelease
{
    Child2    child;

    public AlwaysRelease ()
    {
       child = new Child2();
    }

    private static class Child2
    {
    }
}
Technical Details
Message-ID: <42ca2130$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!newsread.com!newsprint.newsread.com!newspeer.tds.net!news-out.news.tds.net!205.215.62.125.MISMATCH!in.100proofnews.com!in.100proofnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,afdd6d6a52ac0c35,start
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 05 Jul 2005 07:57:31 +0200
From: Vander <874505@gmx.de>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing
Subject: Reference and Garbage Collection
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 84.152.221.198
Message-ID: <42ca2130$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1120543024 84.152.221.198 (4 Jul 2005 22:57:04 -0700)
Lines: 39
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!newsread.com!newsprint.newsread.com!newspeer.tds.net!news-out.news.tds.net!205.215.62.125.MISMATCH!in.100proofnews.com!in.100proofnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail