}
new Main_1().teste();
}
Runtime rt = Runtime.getRuntime();
long lastFree = rt.freeMemory();
while(true) {
try {
float freePercent = ((float)rt.freeMemory())/rt.totalMemory();
System.out.println ("Mem: "
+ (rt.totalMemory() - rt.freeMemory())/1024
+ "/" + rt.totalMemory()/1024 + "\t" + freePercent + "%");
if(lastFree < rt.freeMemory()) {
System.out.println("Free increased!!!!!!!!!!!!!!!!!!!!!");
Thread.sleep (2000);
}
Thread.sleep (10);
lastFree = rt.freeMemory();
} catch(Exception e){
e.printStackTrace();
}
}
}
new Thread(this).start();
}
}
James Stauffer
From: James Stauffer [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 10, 2003 11:05 AM
To: jdjlist
Subject: [jdjlist] RE: Memory growing alone
James Stauffer
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 <[EMAIL PROTECTED]>
A : jdjlist <[EMAIL PROTECTED]>
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
aloneclass=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
