Skip to main content

[JAVA2D] Memory Problems with the garbage collection

6 replies [Last post]
Anonymous

Dear fellows,

we are working with highly complex structured hierarchical objects in bioinformatics
and do allocate a hugh amount of memory (>1000 MByte).

As soon as the depth of the object tree becomes too high, JAVA is no more able
to remove unreachable temporary objects, leading to more and more uncleared
memory and at last to "OutOfMemory".

The problem might arise from used big loops out of one routine, since I read
some weeks ago that the garbage collection can only remove temporary objects
when the calling master method is terminated. (I think these references are
called "weak", "phantom" or whatever).

Does anyone know, how I can enforce memory to be freed whenever a reference
becomes unreachable, meaning that these temporary objects become reachable
for the garbage collection even if the calling method has not terminated?

It would help us a lot to find a workaround, because this property seems to be
a severe limitation in nerdy bioscience applications! This request does not really
match the JAVA2D homepage, although we also do a lot of graphical animation.
But the error certainly is not from JAVA2D, so perhaps somebody also knows a
more appropriate mailing list or resorce to discuss my problem?

Thank you all,
Sven

________________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sven Mielordt

****** Dear Dmitri,
thank you for the advice concerning GC. But I did not get an improvement
by tuning the parameters; the essential behavior remains the same.

****** Dear Frank,
Tree branches can be cut off by de-referencing nodes, this is not the problem.

****** Dear Brian,
probably you got the real reason for my problem: YES, I am heavily using
inner classes which also have many further inherited classes....

The idea was to write a parser for XML formatted data of whole chromosome
annotations. I did not get so happy with DOM or SAX parsers since both
run into "OutOfMemory" when using them here. Also this was an unexplained feature,
but I decided to implement this inner class structure instead as a workaround.

Unfortunately, this induced my present memory problems: When being deep inside
inner classes, TEMPORARY objects are NOT GC'd. (Tree branches can be cut off,
this is not the problem.) For me this is a bug in JAVA since I do not get
the point why this must be. Probably I will have to unravel this structure
into independent classes, but this is a hard way and not as performant
as before.

Does anyone know a way how to enforce TEMPORARY objects of inner
classes to be GC'd ???? This might also be the reason why DOM and SAX
parsers make problems as well on VERY BIG XML documents.

Thanx a lot,
Sven

Brian.Peterson@gd-ais.com schrieb am 27.12.04 19:04:08:
>
> Hi Sven,
>
> Where did you read that Java won't GC an object until the calling method
> completes? I ran a quick test -- a routine that just created objects -- and
> they still got gc'd.
>
> It could be that the objects you are creating are being pinned by some
> reference, and that's why they aren't getting GC'd. I got surprised by this
> once when using an inner class.
>
> Best way to track that down is to profile it with something like OptimizeIt
> or JProbe and take a look at the references.
>
> Brian
>
schrieb am 27.12.04 20:15:30:
>
> Wow, I doubt that you would have pretty much less trouble in any other
> language if you try to cram a chunk of 1000Mbyte+ into RAM. Did you run a
> profiler to detect that your problem is actually a problem of the
> garbage-collection?! I think I don't get the "business-case" behind that
> yet: If you have a complex structured hierarchical object, how does it come
> that there are objects that are unreferenced and can be garbage-collected?
> Do you have a tree and you manually cut of the branches by de-referencing
> nodes?! Unless you do so, I don't yet see, how and where garbage-collection
> can actually take place in this hierarchy, as long as there is still a leaf
> that holds a reference. Maybe you can provide some background on what you're
> trying to achieve...
>
> Cheers
> stf
>
> -----Original Message-----
> From: Discussion list for Java 2D API
> [mailto:JAVA2D-INTEREST@JAVA.SUN.COM]On Behalf Of Sven Mielordt
> Sent: Monday, December 27, 2004 12:05 PM
> To: JAVA2D-INTEREST@JAVA.SUN.COM
> Subject: [JAVA2D] Memory Problems with the garbage collection
>
>
> Dear fellows,
>
> we are working with highly complex structured hierarchical objects in
> bioinformatics
> and do allocate a hugh amount of memory (>1000 MByte).
>
> As soon as the depth of the object tree becomes too high, JAVA is no more
> able
> to remove unreachable temporary objects, leading to more and more uncleared
> memory and at last to "OutOfMemory".
>
> The problem might arise from used big loops out of one routine, since I read
> some weeks ago that the garbage collection can only remove temporary objects
> when the calling master method is terminated. (I think these references are
> called "weak", "phantom" or whatever).
>
> Does anyone know, how I can enforce memory to be freed whenever a reference
> becomes unreachable, meaning that these temporary objects become reachable
> for the garbage collection even if the calling method has not terminated?
>
> It would help us a lot to find a workaround, because this property seems to
> be
> a severe limitation in nerdy bioscience applications! This request does not
> really
> match the JAVA2D homepage, although we also do a lot of graphical animation.
> But the error certainly is not from JAVA2D, so perhaps somebody also knows a
> more appropriate mailing list or resorce to discuss my problem?
>
> Thank you all,
> Sven

________________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Keith Lea

I'm almost certain that the JVM will garbage-collect *all* objects which
are no longer referenced. You should definitely download a memory
profiler like JFluid (part of NetBeans 4.0) or YourKit Profiler, to find
out where your memory leak is.

-Keith

Sven Mielordt wrote:
> Unfortunately, this induced my present memory problems: When being deep inside
> inner classes, TEMPORARY objects are NOT GC'd. (Tree branches can be cut off,
> this is not the problem.) For me this is a bug in JAVA since I do not get
> the point why this must be. Probably I will have to unravel this structure
> into independent classes, but this is a hard way and not as performant
> as before.
>
> Does anyone know a way how to enforce TEMPORARY objects of inner
> classes to be GC'd ???? This might also be the reason why DOM and SAX
> parsers make problems as well on VERY BIG XML documents.

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Dmitri Trembovetski

Hi Sven,

you might want to look at this tutorial on how to tune jvm's garbage
collection:
http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html

There's more useful information here:
http://java.sun.com/docs/hotspot/

Thank you,
Dmitri

On Mon, Dec 27, 2004 at 06:05:22PM +0100, Sven Mielordt wrote:
> Dear fellows,
>
> we are working with highly complex structured hierarchical objects in bioinformatics
> and do allocate a hugh amount of memory (>1000 MByte).
>
> As soon as the depth of the object tree becomes too high, JAVA is no more able
> to remove unreachable temporary objects, leading to more and more uncleared
> memory and at last to "OutOfMemory".
>
> The problem might arise from used big loops out of one routine, since I read
> some weeks ago that the garbage collection can only remove temporary objects
> when the calling master method is terminated. (I think these references are
> called "weak", "phantom" or whatever).
>
> Does anyone know, how I can enforce memory to be freed whenever a reference
> becomes unreachable, meaning that these temporary objects become reachable
> for the garbage collection even if the calling method has not terminated?
>
> It would help us a lot to find a workaround, because this property seems to be
> a severe limitation in nerdy bioscience applications! This request does not really
> match the JAVA2D homepage, although we also do a lot of graphical animation.
> But the error certainly is not from JAVA2D, so perhaps somebody also knows a
> more appropriate mailing list or resorce to discuss my problem?
>
> Thank you all,
> Sven
>
>
>
>
> ________________________________________________________________
> Verschicken Sie romantische, coole und witzige Bilder per SMS!
> Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Michele Puccini

A bit off topic but I know there are some gurus here..

I'm creating a visual generalpath editor and I would like to implement the
"split path" feature i.e. clicko on the path and add an editable point on
it. Line_to are working, but... is there someone that can tell me how to
split a cubic curve 2d at a given point into a pair of cubics and keep the
same aspect of the original ?

Mik
--

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Jérôme Thièvre

You should look at method subdivide in class java.awt.geom.CubicCurve2D.
I'm not you can do this directly on a GeneralPath object.

Jérôme

----- Original Message -----
From: "Michele Puccini"
To:
Sent: Monday, January 17, 2005 5:21 PM
Subject: [JAVA2D] Split cubic ?

> A bit off topic but I know there are some gurus here..
>
> I'm creating a visual generalpath editor and I would like to implement the
> "split path" feature i.e. clicko on the path and add an editable point on
> it. Line_to are working, but... is there someone that can tell me how to
> split a cubic curve 2d at a given point into a pair of cubics and keep the
> same aspect of the original ?
>
> Mik
> --
>
>
===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the
body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Michele Puccini

Java2D is fantastic.
Thanks Jérôme, it works perfectly.

Mik
============================================================================
> ClassX Development Italy Via Francesca, 368/I I-56030 S.M. a Monte (PI) <
> Tel.(+39)-0587-705153 Fax.(+39)-0587-705153 WEB: http://www.classx.it <
============================================================================

----- Original Message -----
From: "Jérôme Thièvre"
To:
Sent: Monday, January 17, 2005 5:33 PM
Subject: Re: [JAVA2D] Split cubic ?

> You should look at method subdivide in class java.awt.geom.CubicCurve2D.
> I'm not you can do this directly on a GeneralPath object.
>
> Jérôme

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".