Hi,

I still have problems with the memory usage, during printing.
I looked again at the PrintCanvas3D example. In this example there is
created once an OffScreenCanvas3D object, and this is reused every time
for printing (Memory increases once and then stays stable at a higher
level).
Ok I guess, I could change my application, so that such an object is
created only once as well. Unfortunately the creation costs memory and I
do not want to increase my memory for the rest of the operation time, only
because, someone wants to print.
Is there any possibility to get rid of the OffScreenCanvas again, and free
the memory, so that my application has some memory left for other tasks?

I tried the following:

        basically I tried to remove the OffScreenCanvas3D from the view
        after printing, set it to null and then call the Garbage
        Collector.


I really would appreciate some help, thanks Desiree


        configTest = SimpleUniverse.getPreferredConfiguration();
        offScreenCanvas3dTest = new OffScreenCanvas3D(configTest,true);
        // Set the off-screen size based on a scale factor times the
        // on-screen size

        sOn = c.getScreen3D();
        sOff = offScreenCanvas3dTest.getScreen3D();
        dim = sOn.getSize();

        dim.width *= OFF_SCREEN_SCALE;
        dim.height *= OFF_SCREEN_SCALE;
        sOff.setSize(dim);
        sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth() *
                                    OFF_SCREEN_SCALE);
        sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight() *
                                         OFF_SCREEN_SCALE);
        // attach the offscreen canvas to the view
        u.getViewer().getView().addCanvas3D(offScreenCanvas3dTest);

        Point loc = c.getLocationOnScreen();
        offScreenCanvas3dTest.setOffScreenLocation(loc);
        dim = c.getSize();
        dim.width *= OFF_SCREEN_SCALE;
        dim.height *= OFF_SCREEN_SCALE;

        addBackgroundNode();

        //Background testBack = new Background(new
Color3f(1.0f,1.0f,1.0f));
        //offScreenCanvas3d.setBackgroundNode(testBack);
        u.setJ3DThreadPriority( Thread.currentThread().getPriority() );
        bImage = offScreenCanvas3dTest.doRender(dim.width, dim.height);
        bImage.flush();

        removeBackgroundNode();

        u.getViewer().getView().removeCanvas3D(offScreenCanvas3dTest);
        offScreenCanvas3dTest = null;
        configTest = null;
        sOn = null;
        sOff = null;

        System.gc();
        System.runFinalization();

oooooooooooooooooooooooooooooooooooooooooooooooo
Desiree Hilbring

Institut fuer Photogrammetrie und Fernerkundung
Universitaet Karlsruhe, Germany
email: [EMAIL PROTECTED]
# 0721 6083676
oooooooooooooooooooooooooooooooooooooooooooooooo

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