Some kind of slow leak?



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.

.



Relevant Pages

  • Re: Reprise: Pended IOCtrl + LoadLibrary == Deadlock?
    ... the original probelm in the debugger, ... and execute!htrace in both devenv.exe and the target app. ... > If I try to reproduce the error by launching the app from DevStudio, ... >>> ....looking at the docs for STARTUPINFO, ...
    (microsoft.public.development.device.drivers)
  • Re: Reprise: Pended IOCtrl + LoadLibrary == Deadlock?
    ... I have run appverifier and!htrace on the app. ... If I try to reproduce the error by launching the app from DevStudio, ... >> ....looking at the docs for STARTUPINFO, ... > you seem to have KD and a user mode debugger. ...
    (microsoft.public.development.device.drivers)
  • Re: Install problem (previous version of windows mobile)
    ... Are you sure your app can handle the screen resolution of the ... Pocket PC 2003 you've been testing? ... When I run programs under the Windows CE debuggers, ... run on their on (on real devices without a debugger). ...
    (microsoft.public.pocketpc.developer)
  • Re: Device driver crash ?? - in udevice.exe
    ... Thanks again - will get back once I've had a play with the debugger:-O. ... document somewhere which explains this (KITL etc.) process ??. ... NB I need to use the serial ports for my app - so need KITL to use ... device drivers - and it seems to be running some 33 threads - normally ...
    (microsoft.public.windowsce.embedded)
  • Re: Windows Forms apps not "ending" when you close the form window
    ... I would suspect that the application starts a worker thread ... The thread, in turn, prevents the app from finishing. ... the debugger on any regular basis. ... Either it's breaking before the closing ...
    (microsoft.public.dotnet.languages.vc)