aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2005-02-22 23:13:04 +0000
committerChien Yang <[email protected]>2005-02-22 23:13:04 +0000
commitd918f6e6ca177a2f591fa0c4338a306d2c54ac5d (patch)
treea795b01016e8c3a4af5a85c2238f2346950caadc
parentfeeaacfb070bfa2371c95d35e76e8000c2c550f5 (diff)
Fixed issue 103 : Memory leak:: View deactivate not full enabled
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@136 ba19aa83-45c5-6ac9-afd3-db810772062c
-rw-r--r--src/classes/share/javax/media/j3d/MasterControl.java14
-rw-r--r--src/classes/share/javax/media/j3d/View.java9
2 files changed, 23 insertions, 0 deletions
diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java
index 10de1c8..c70b268 100644
--- a/src/classes/share/javax/media/j3d/MasterControl.java
+++ b/src/classes/share/javax/media/j3d/MasterControl.java
@@ -449,6 +449,15 @@ class MasterControl {
// attribute is set to false.
boolean sortShape3DBounds = false;
+ //Set by -Dj3d.forceReleaseView property.
+ //Setting this flag as true disables the bug fix 4267395 in View deactivate().
+ //The bug 4267395 can lock-up *some* systems, but the bug fix can
+ //produce memory leaks in applications which creates and destroy Canvas3D
+ //from time to time.
+ //Set as true if you have memory leaks after disposing Canvas3D.
+ //Default false value does affect Java3D View dispose behavior.
+ boolean forceReleaseView = false;
+
/**
* Constructs a new MasterControl object. Note that there is
* exatly one MasterControl object, created statically by
@@ -494,6 +503,11 @@ class MasterControl {
"Shape3D bounds enabled for transparency sorting",
"Shape3D bounds *ignored* for transparency sorting");
+ forceReleaseView =
+ getBooleanProperty("j3d.forceReleaseView", forceReleaseView,
+ "forceReleaseView after Canvas3D dispose enabled",
+ "forceReleaseView after Canvas3D dispose disabled");
+
useCombiners = getBooleanProperty("j3d.usecombiners", useCombiners,
"Using NV_register_combiners if available",
"NV_register_combiners disabled");
diff --git a/src/classes/share/javax/media/j3d/View.java b/src/classes/share/javax/media/j3d/View.java
index 255fe80..2b54b6a 100644
--- a/src/classes/share/javax/media/j3d/View.java
+++ b/src/classes/share/javax/media/j3d/View.java
@@ -3307,6 +3307,15 @@ public class View extends Object {
// This is a temporary fix for bug 4267395
// TODO:cleanup in RenderBin after View detach
// universe.addViewIdToFreeList(viewId);
+
+ // using new property -Dj3d.forceReleaseView to disable bug fix 4267395
+ // this bug fix can produce memory leaks in *some* applications which creates
+ // and destroy Canvas3D from time to time. This just add the view in the
+ // FreeList earlier.
+ if (VirtualUniverse.mc.forceReleaseView) {
+ universe.addViewIdToFreeList(viewId);
+ }
+
J3dMessage vpMessage = VirtualUniverse.mc.getMessage();
vpMessage.universe = universe;