Title: RE: [jdjlist] RE: Memory growing alone

I just wanted to clarify that this is how it is supposed to work and isn't a cause for alarm.

James Stauffer


-----Original Message-----
From: Spencer W. Thomas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 10, 2003 11:36 AM
To: jdjlist
Subject: [jdjlist] RE: Memory growing alone


Indeed.  I added an iteration counter, reduced the sleep time, and found
this behavior:

Iteration 652
total :1984
used :511
Iteration 653
total :1984
used :84

(I also changed the word "free:" to "used:" to reflect what it's
actually measuring.)  This on WinXP with JRE 1.4.2, running under
Eclipse 2.1.1.  Your mileage may vary.

=Spencer

James Stauffer wrote:

> This may be happening:
> Every time that it does through the loop it has to create some
> temporary objects to print out the info. Those objects probably won't
> be garbage collected until free memory is low.

>
> James Stauffer
>
> -----Original Message-----
> *From:* Sebastien RODRIGUES [mailto:[EMAIL PROTECTED]]
> *Sent:* Wednesday, September 10, 2003 10:50 AM
> *To:* James Stauffer
> *Subject:* Re: [jdjlist] RE: Memory growing alone
>
> import java.util.*;
>
> public class Main_1 implements Runnable
>
> {
>
> public Main_1 ()
>
> {
>
> }
>
> public static void main (String[] args)
>
> {
>
> new Main_1 ().teste ();
>
> }
>
> public void run ()
>
> {
>
> while(true)
>
> {
>
> try
>
> {
>
> this.t.sleep (2000);
>
> System.out.println ("total :"+Runtime.getRuntime ().totalMemory ()/1024);
>
> System.out.println ("free :"+(Runtime.getRuntime ().totalMemory
> ()-Runtime.getRuntime ().freeMemory ())/1024);
>
> }catch(Exception e){}
>
> }
>
> }
>
> private Thread t;
>
> public void teste ()
>
> {
>
> t = new Thread (this);
>
> t.start ();
>
> }
>
> }
>
> Using only this code the memory grow 1ko by 2seconds!
>
> Why?
>

>
> I'm surching from a free profiler!
>
>
>     Message du 10/09/03 17:41
>     De : James Stauffer
>     A : jdjlist
>     Copie � :
>     Objet : [jdjlist] RE: Memory growing alone
>
>
>
>
>
>
>
>
>     size=2>If the code if small you could post it.
>     
>
>     James Stauffer
>
>
>
>     size=2>-----Original Message-----
>     *From:* Greg Nudelman
>     [mailto:[EMAIL PROTECTED]]
>     *Sent:* Wednesday, September 10, 2003
>     10:27 AM
>     *To:* jdjlist
>     *Subject:* [jdjlist] RE: Memory growing
>     alone
>
>
>     class=966032015-10092003> Dear
>     Sebastien,
>     class=966032015-10092003>
>     size=2> 
>     class=966032015-10092003> You're probably
>     creating additional objects (in a loop?) with each re-fresh
>     cycle.  Make
>     sure you allow the old objects to be garbage collected by
>     assigning myOldObj =
>     null; when you're done with them.  It's harder then it sounds:
>     these are
>     hard bugs to track down.  Look into Sun's java -verbose mode, it
>     will tell
>     you more about which objects are created.  (see java -?) There are
>     lots of
>     good profilers out there for free so look into those
>     also.
>     class=966032015-10092003>
>     size=2> 
>     class=966032015-10092003> Good
>     luck,
>     class=966032015-10092003>
>     size=2> 
>     class=966032015-10092003>
>     size=2>Greg
>
>
>         align="left"> -----Original
>         Message-----
>         *From:* Sebastien RODRIGUES
>         [mailto:[EMAIL PROTECTED]]
>         *Sent:* Wednesday, September
>         10, 2003 8:00 AM
>         *To:* jdjlist
>         *Subject:* [jdjlist] Memory
>         growing alone
>
>
>         Hi,
>
>
>         I have a big problem with my program!
>
>
>         When i started the gui program and let it running alone
>         showing only memory
>         used!
>
>
>         The memory used grow with 31 Ko more each second!
>
>
>         How i can reduce this?
>
>
>         On a perfect word the memry used should be the same if program
>         don't work!
>
>
>         Sorry i'm not on perfect word i'm on windows 2000!
>
>
>         Any idea?
>
>
>         
>
>
>         Regards
>
>         --- You are currently subscribed to jdjlist as:
>         [EMAIL PROTECTED] To unsubscribe send a blank email to
>         [EMAIL PROTECTED]
>         http://www.sys-con.com/fusetalk
>
>     ---
>     You are currently subscribed
>     to jdjlist as: [EMAIL PROTECTED]
>     To unsubscribe send a blank email
>     to [EMAIL PROTECTED]
>     http://www.sys-con.com/fusetalk
>
>     ---
>
>
>     You are currently subscribed to jdjlist as:
>     [EMAIL PROTECTED]
>
>
>     To unsubscribe send a blank email to
>     [EMAIL PROTECTED]
>
>
>     http://www.sys-con.com/fusetalk
>
>
> ---
> You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
> [EMAIL PROTECTED]
> http://www.sys-con.com/fusetalk



---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
http://www.sys-con.com/fusetalk

---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
http://www.sys-con.com/fusetalk

Reply via email to