🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2577

Re: Why Java Program eats Memory?!

#2577
From: Ali Demir
Date: Sun, 17 Sep 2000 00:00
54 lines
2337 bytes
There are alot of memory problems in Java. Garbage Collection does not mean
automatic memory deallocation. It means that and object is guaranteed to be
not deleted if it is needed. To make an object available to be garbage
collected, you should make sure that it is not reachle.

Let's say you have a tree structure:

Database
    Tables
        Columns

and lets say there is parent child relationship between these objects.
That is they are linked so that you reach a column by:

Database.Table[x].Column[y]

and also You can do Column.parent.parent to reach the database.

Now lets assume from your main panel, you hold a reference to the Database
object only. Then setting this refence to null is enough for the whole tree
structure to be garbage collected.

BUT: if you have another reference from another panel (that is strongly
reachable from your main panel) to just ONE of the column objects in the
tree structure, then NOTHING will get garbage collected when you set your
main panel's Database reference to null. BECAUSE theoretically, all of your
objects are still reachable from your main panel through:

mainPanel.childPanel.column.parent.parent which is your Database object.

Sucks right? That is our so belowed Java.

Ali


"banxuegang" <ban@cae.wisc.edu> wrote in message news:39c28555$1_2@dnews...
> Hi,
> I used Thread class in my Java Application. There is a loop in it. But, I
> found that every time this loop execuates, the system memory is eaten by 5
> MB. What's the problem? I think there are should not Memory problems in
Java
> Programming. But....
> Thanks.
>
>
> --
> Xuegang Ban
> Civil&Enviromental Engineering Department,
> Univ. of Wisconsin-Madison
> Email: ban@cae.wisc.edu
> Phone: 608-262-3967(o)
>             608-260-9123(h)
>
>
Technical Details
Message-ID: <39c5708e$1_2@dnews>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39c28555$1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,80c63c7225823056
X-Google-Attributes: gid1089d0,public
From: "Ali Demir" <ademir@informix.com>
Subject: Re: Why Java Program eats Memory?!
Date: 2000/09/17
Message-ID: <39c5708e$1_2@dnews>
X-Deja-AN: 671031194
References: <39c28555$1_2@dnews>
X-Trace: 17 Sep 2000 18:31:58 -0800, 24.19.144.88
X-MSMail-Priority: Normal
X-Priority: 3
Newsgroups: borland.public.jbuilder.java.api
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700