Memory Leak [message #444233] |
Sat, 09 October 2004 05:54  |
Eclipse User |
|
|
|
Hi!
In my application, after I do a bunch of operations, I get a Java
OutOfMemoryError. Is it likely that this error is happening because I am
not disposing my SWT objects (i.e. widgets, images, etc.)?
I thought that SWT objects predominantly use native memory. If this is
true, then failing to dispose SWT objects would probably not be the cause
of an OutOfMemoryError. Is this correct?
Thanks!
Ryan
|
|
|
|
|
Re: Memory Leak [message #444426 is a reply to message #444233] |
Tue, 12 October 2004 11:43   |
Eclipse User |
|
|
|
OutOfMemoryError is never causes by leaking operating system resources.
Rather, it is caused by "leaking" Java objects. How is this possible when
Java is a garbage collected language? A Java object is "leaked" when an
application unintentionally keeps a reference to an object (say in a static
variable) and the garbage collector can't do its job. When an SWT object is
disposed, not only are operating system resources released but interal
object references are set to null so that, even if an application were to
hold into an SWT object and defeat the garbage collector, the objects inside
can be released. It's the best we can do.
"Ryan" <a@b.com> wrote in message news:ck8cgq$qck$1@eclipse.org...
> Hi!
>
> In my application, after I do a bunch of operations, I get a Java
> OutOfMemoryError. Is it likely that this error is happening because I am
> not disposing my SWT objects (i.e. widgets, images, etc.)?
>
> I thought that SWT objects predominantly use native memory. If this is
> true, then failing to dispose SWT objects would probably not be the cause
> of an OutOfMemoryError. Is this correct?
>
> Thanks!
>
> Ryan
>
|
|
|
Re: Memory Leak [message #444434 is a reply to message #444233] |
Tue, 12 October 2004 12:32  |
Eclipse User |
|
|
|
Hi Ryan,
You can use JProbe Memory Debugger or Optimizeit tools to find out what's
wrong in your app. Might be as simple as an innocent looking Hashtable that
stores one billion of String by accident...
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.05664 seconds