Some kind of slow leak?

Discussion in 'Java' started by Twisted, Feb 24, 2006.

  1. Twisted

    Twisted Guest

    I have a Java app I'm developing here that seems to have developed a
    slow leak.

    It spawns around 100 threads, which do various things with some shared
    resources (mainly collections); the resources are locked (in a fixed
    order) before use, so this shouldn't be a concurrency issue. These
    collections are periodically either wiped or halved in size, when they
    grow to certain sizes, so that they cannot cause the memory use of the
    app to grow without bound.

    Yet grow it does; the task eventually bloats up to 90+ meg and when it
    gets to that size, it becomes slow and unstable. Then I start getting
    crashes. Best case, weird exceptions or OutOfMemoryErrors (when there's
    still 3/4 of the machine's physical RAM free!) pop up and it tries to
    exit gracefully. Or it lurches to a halt (hangs, possibly taking the
    IDE down with it if its debugger is attached to the process), or it
    outright crashes (sigsegv in Hotspot VM).

    Anyone have an idea what's happening here? Lots of objects are created
    transiently and discarded -- is it possible the system GC isn't able to
    keep up with the rate at which this occurs? (Translation: use less
    threads, even if it means the app spends more time idling and less
    accomplishing something useful.) Or is there a way that things might be
    hanging around, and cruft slowly accumulating in memory that isn't
    getting swept away? (Possibly a library call that uses a native method?
    Native methods written in C could leak easily, unlike Java code.) Or
    perhaps attaching a debugger is itself causing the bloat? (Objects the
    debugger notices may hang around because the debugger hangs onto
    references, which stop them being gc'd?)

    JDK and JRE version 1.5.0_06.
    Twisted, Feb 24, 2006
    1. Advertisements

  2. Guest

    Have you tried increasing the heap size of the JVM. Just because you
    have available memory on the machine doesn't mean it will automatically
    be available to your process.
    , Feb 24, 2006
    1. Advertisements

  3. Twisted

    Twisted Guest


    Anyway, I'd prefer to actually fix its mem use not to be so excessive.
    Nothing it does requires even 90-odd megs...
    Twisted, Feb 24, 2006
  4. Guest

    Perhaps someone who suggest a profiling tool to use? Without looking
    thought source it is hard to offer any other suggestions.
    , Feb 25, 2006
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. UJ
  2. mehdi_mousavi
    Sep 7, 2005
  3. Jan Kesten
    Gerrit Holl
    Jan 18, 2004
  4. Joh
    Lonnie Princehouse
    Jul 15, 2004
  5. Richard Heathfield

    Leak or no leak ??

    Richard Heathfield, Jul 10, 2006, in forum: C Programming
    Richard Heathfield
    Jul 10, 2006

Share This Page