Hi Crispin, How you doing?

Your original question never did get a satisfactory answer.
However it's definitely not the same as Luigi's.

Perhaps you could try the code below; on Suns Windows JDK1.2
the total
stays constant at 1m, and the free highwater mark hovers
around 820k,
at least for the first 4 million iterations round the inner
loop.
My linux died, so I can't try it here (

Nick

public class SBTest2 {
    public static void main( String[] args ) {
       int i = 0;
       while(true) {
         long free = Runtime.getRuntime().freeMemory();
         long total = Runtime.getRuntime().totalMemory();
         for( int j = 0; j < 1000; j++ ) {
             System.out.println(i + ", free = " + free + ",
total = " + total );
             i++;
         }
       }
    }
}

Crispin Miller wrote:

> I posted to the group recently with a very similar problem to Luigi's problem -
> I think there is a memory leak in StringBuffer somewhere: the following code
> slowly eats up memory (it doesn't on a Sun).
>
> (running on JDK1.2-pre1).
>
> import java.util.*;
>
> public class SBTest {
>     public SBTest() {
>        int i = 0;
>        while(true) {
>          System.out.println(i + " ");
>            i++;
>            System.out.flush();
>            System.gc();
>        }
>     }
>
>     public static void main(String[] args) {
>        SBTest m = new SBTest();
>
>     }
>  }
>
> Crispin
>
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to