: [JAVA3D] Memory handling
Oops,
Also, to truly override finalize of the Java native classes,
finalize must be declared protected, not private as I formerly stated or
public as in Karsten's code.
thanks for the correction. Lazyness is always awkward.
protected void finalize() throws
Oops,
Also, to truly override finalize of the Java native classes,
finalize must be declared protected, not private as I formerly stated or
public as in Karsten's code.
thanks for the correction. Lazyness is always awkward.
protected void finalize() throws Throwable {
// your code /
().
Christopher
-Original Message-
From: Lan Wu-Cavener [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 13, 2001 5:38 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Memory handling
I am running into this java.lang.OutOfMemoryError (no trace stack
available) problem when my program detach some
: Christopher Collins [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Monday, July 16, 2001 01:34
Subject: Re: [JAVA3D] Memory handling
[snip]
You can force the garbage collection somewhat by calling System.gc
Greg Munt wrote:
System.gc is not guaranteed to do ANYTHING.
Yes it is. It is guaranteed that the VM will make its best efforts to
reduce the amount of currently allocated memory that has no references
to it. If it has no free references to collect, then it will not appear
to do anything, but
System.gc() is effectively equivalent to the call:
Runtime.getRuntime().gc()
-Original Message-
From: Greg Munt [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 16, 2001 10:39 AM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Memory handling
This is just not true. Garbage collection is never
Oouch,
private void finalize() {
System.out.println(BranchGroup finalized);
}
this is definitely not the way to do it. This is a AntiPattern in Java!!!
When overriding finalize make sure you use this construct
public void finalize() java.lang.Throwable {
// this is very
Oops! Big mistake!
Of course if I had actually referred to my working code, I would have
recalled the super.finalize() call and the throwable declaration...
Any text or FAQ can explain finalize and it's use more clearly. Sorry
for my mistake!
However, I think the following would be better
I am running into this java.lang.OutOfMemoryError (no trace stack
available) problem when my program detach some BranchGroup objects, and
re-generate them as the user navigates through the graphic scene. The
regenerated BranchGroup objects are not any larger than its previous
counterparts, but