[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Memory leak in 1.5.0 JVM
- To: Nick Johnson <freebsd_(_at_)_spatula_(_dot_)_net>
- Subject: Re: Memory leak in 1.5.0 JVM
- From: Mika Nystrom <mika_(_at_)_async_(_dot_)_caltech_(_dot_)_edu>
- Date: Fri, 22 Feb 2008 02:30:20 -0800
- Cc: mika_(_at_)_camembert_(_dot_)_async_(_dot_)_caltech_(_dot_)_edu, freebsd-java_(_at_)_freebsd_(_dot_)_org
Thanks for the explanation! I guess I can just chalk up another
reason on my list of reasons "why I would never use Java for anything
I care about [given the choice]". Better garbage collectors were
described by Dijkstra et al... now 30 years ago.
This is what my NOP-program does after allocating a gigabyte (only
takes a couple of minutes on a Q6600):
Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
Nick Johnson writes:
>On Thu, 21 Feb 2008, Mika Nystrom wrote:
>> Out-running the garbage collector? I'm not used to Java, but in
>> Modula-3, the garbage collector gets called when you allocate memory,
>> is that not how it works in Java?
>In a word, no. Garbage collection in Java is asynchronous. In the Sun
>JVM there are several different garbage collection strategies. The
>default strategy uses multiple "generations"-- a "new" generation for
>short-lived objects; those objects that live through a new generation
>collection get promoted to one of many "survivor" spaces, and those that
survive collection there (either because of time or exhausting the size of
>the survivor space) get promoted to the "tenured" or "old" generation.
>Then there's a "permanent" generation for classes and other stuff.
>If you just sit and watch the memory size of a JVM process, it might
>appear to be "leaking" memory, but what's happening under the hood is far
>more complicated than that. The JVM will also grow to accomodate the
>amount of memory it has needed to allocate, but won't necessarily -shrink-
>again once those objects are garbage collected. In a long-running
>process, chances are that if a program needed 256M once, it's going to
>need it again.
>To get a real good idea of what's going on under the hood, look at tools
>like jvmstat and visualgc.
>This document will give you a much more detailed view than my rough
>"Courage isn't just a matter of not being frightened, you know. It's being
> afraid and doing what you have to do anyway."
> Doctor Who - Planet of the Daleks
>This message has been brought to you by Nick Johnson 2.3b1 and the number 6.
>http://healerNick.com/ http://morons.org/ http://spatula.net/
freebsd-java_(_at_)_freebsd_(_dot_)_org mailing list
To unsubscribe, send any mail to "freebsd-java-unsubscribe_(_at_)_freebsd_(_dot_)_org"
Visit your host, monkey.org