Hi Kelvin,

I added the following statements in deleteButtonActionPerformed() function
after the line of "com.sun.j3d.utils.universe.Viewer.clearViewerMap();" :
        BranchGroup emptyGroup = new BranchGroup();
        emptyGroup.setCapability(BranchGroup.ALLOW_DETACH);
        universe.getLocale().addBranchGraph(emptyGroup);
        universe.getLocale().removeBranchGraph(emptyGroup);
        emptyGroup = null;

I tested it again. Compared to the last run, it does release some memory by
collecting the "Appearance and Sphere" objects, but all the Material objects
created when I add the Spheres are not collected, and there is a reference
graph like:
    Canvas3D---...----MaterialRetained---Material

In my program, the Material object is only referred by Appearance object.
If the Appearance object is released, I suppose the Material object should
be also released, but it's not. Is this also a memory leak???

Thanks,  ---white


On Thu, 26 Jun 2003 15:00:31 -0700, Kelvin Chung <[EMAIL PROTECTED]> wrote:

>White Morph wrote:
>
>>>N. Vaidya wrote:
>>>
>>>
>>>
>>>>>On Wed, 25 Jun 2003 15:06:27 -0700, Kelvin Chung <[EMAIL PROTECTED]> >wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>>Bug 4884065 - Memory leak in SetLiveState when branchGroup remove
>>>>>
>>>>>is filed for this.
>>>>>
>>>>>Actually this is not that serious as the memory will free next time
>>>>>the same SimpleUniverse is used. Otherwise you can always set
>>>>>SimpleUniverse to null to force cleanup.
>>>>>
>>>>>
>>
>>Thanks for the confirmation for the bug, but I don't agree that it's not so
>>serious, because the BranchGroup can refer to a lot of objects and hence
>>consumes a lot of memory, which is not available for other processing before
>>a new model is loaded again.
>>
>>
>As Raj point out after the branchGroup detach you can attach another empty
>BranchGroup to force cleanup memory reference by the temp. variable
>SetLiveState.
>
>There is a workaround.
>
>>Setting SimpleUniverse to null is not appropriate if I want to keep other
>>BranchGroup or Background or whatever.
>>
>>---white
>>
>>
>>
>- Kelvin
>---------------
>Java 3D Team
>Sun Microsystems Inc.
>
> ==========================================================================
>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".

===========================================================================
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".

Reply via email to