Hi Karthikeyan,
In this call,
mainBranchGroup.addChild(createSceneGraph(canvas3D));
The canvas3D may still reference to old View or
you may have some other global variable refer to
SimpleUniverse.
You should also set ViewingPlatform to null and remove
all Canvas3D attach to the View as follows:
simpleuniverse.getViewer().setViewingPlatform(null);
simpleuniverse.getViewer().getView().removeCanvas3D(c3d);
Note that
simpleuniverse.getViewer().setViewingPlatform(null);
is used instead of
simpleuniverse.getViewer().getView().attachViewPlatform(null)
If SimpleUniverse utility is used.
It is because the ViewingPlatform utility will still hold a reference
to Viewer which in turn hold reference to View.
In fact, a better way is too invoke
VirtualUniverse.removeAllLocales()
and recreate the VirtualUniverse again in refresh().
Also, please use v1.2.1 beta1 as there are bugs in v1.2
which leak memory.
Thanks.
- Kelvin
------------
Java 3D Team
Sun Microsystems Inc.
>X-Unix-From: [EMAIL PROTECTED] Sun Dec 24 04:21:55 2000
>MIME-Version: 1.0
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
>Date: Sun, 24 Dec 2000 16:16:22 +0400
>From: "K.R.Karthikeyan" <[EMAIL PROTECTED]>
>Subject: [JAVA3D] Outofmemory Exception
>To: [EMAIL PROTECTED]
>
>Hi ,
>
>I will explain my program first.
>
>I am having one MainBranchGroup.
>
>I am having one createSceneGraph() Method which will return BranchGroup Object.
>
>I am adding like this
>
> mainBranchGroup.add(createSceneGraph());
>
>
>My application is having 3D Bars, the length, width and height for the Bars
will come from the model.
>
>My createSceneGraph() method will read the model and it will show the Graphics.
>
>
>i have one method called refresh
>
>public void refresh()
>
>{
>
> mainBranchGroup.removeChild(0);
>
> objRoot= null;
>
> objRotate= null;
>
> mainBranchGroup.addChild(createSceneGraph(canvas3D));
>
>}
>
>This is my refresh method. When ever the change in model occurs i will call the
refresh method.
>
>which will remove the 0th element and it will add again another branchgroup.
>
>
>
>/////****** The problem is if i do some user interaction for some 10 times (
ie if i call refresh( ) method 10 times )
>
>it is showing " OutOfMemoryException ".
>
>
>
>Anybody is having any idea about this.
>
>Please help me.
>
>Karthikeyan
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".