All right, so forcing the GC by iconifying the window does not really "free" the memory, i.e. the memory is not given back to the OS.
I know it is the case for all windows application, it even works if you iconify the windows console !! (if your program is run from a console).
Anyway, it is usefull when you have OutOfMemoryError while running your program, and it removed the *big* thorn in my side. By doing that, you just allow your program to run longer without exceeding the allowed memory. By the way, I noticed that past 125MB I have a OutOfMEmoryError : why 125MB? Is there a reason?

Osama, I do no know your appli so I can't tell you where to insert these lines. The only thing I can do is tell you when I inserted them in my program. My appli use JInternalFrames. Each time I open/close, or modify the content of a JInternalFrame I add these lines. I even think about running a thread with a timer that would do the job every 5 or 10 minutes to be sure you desallocate as memory as possible.

I had the same problem using GL4Java, and I think the GC does not work fine with graphics objects. Maybe it is because the corresponding memory is put elsewhere (graphics chip), I don't really know since I am far from being an expert in graphics, but it seemed to me that using the windows system of your OS to fresh memory instead of GC is a good idea....


Florin Herinean wrote:
I think there is another explanation for what Jean is observing: Windows is detecting that the window is no longer fully active, and then it discards large blocks of unused data. That phenomenon is visible with *any* windows program. It's part of how Windows handle memory usage.
 
Besides that, java's own memory handling & gc's is that way that memory allocated from the os is usually not given back, but kept as free *java* memory. So it is possible that the os will report that your app uses 150 mb, but out of that you have 100 mb of free memory inside java. Next time you'll need memory, java will reuse those 100 mb and will not ask the os for memory exept when it's not enough. That's why in usual java (client) programs you will see memory usage going only "up" and (almost) never "down".
 
Cheers,
 
Florin
-----Original Message-----
From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED]]On Behalf Of Fei Li
Sent: Mittwoch, 29. Oktober 2003 23:02
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Memory leak: A simple idea

Hi Jean,
 
From your test I can say it is not memory leak at all. It is Java gc working. Otherwise you won't get memory back even you sleep all day.:)
 
 
----- Original Message -----
Sent: Wednesday, October 29, 2003 10:47 AM
Subject: Re: [JAVA3D] Memory leak: A simple idea

Noticing the same problems with memory leaks, here is what I do each time I remove/add new graphics to display to force freeing memory:

                mainWindow.setState(Frame.ICONIFIED);
        try{ Thread.sleep( 20); }
        catch( InterruptedException ie) {}
        mainWindow.setState(Frame.NORMAL);


I know it is not nice, but works very well since it may free up to 50MB!!
Unfortunately, I don't know if it is possible to do that with an applet....

Osama Abdalah wrote:
Thank you all for your concern,
   But if any one have found this problem before and
solved it please give me a hint since i thing that
this problem is not a minor one since implementing
java3D over swing components is not a strange thing to
do,I hope to find a solution soon since this is
critical for the application i make
                 Best Regards
--- Marty Vona <[EMAIL PROTECTED]> wrote:
  

        
Have you run your app under a tool like Borland
OptimizeIt, which can show you all live objects on
the heap, their reference chains, and their
allocation points?  If not, I suggest that should be
in your near-term plans.

We have had many memory leaks with our app that we
would *not* have been able to solve without the help
of a memory tracing tool like this.  Much more
information is provided in a much more
understandable format than what one can get the JVM
to emit to the console.

Good luck,
Marty


Osama Abdalah writes:
    
thank you for your concern but yet i donot know
      
how to
    
solve this problem it is critical for the
      
application
    
i make
                          Best regards
--- Alessandro borges
      
<[EMAIL PROTECTED]>
    
wrote:
      
Hi,

 I just did a test case like you describe: a
        
simple
    
GUI application with a button to open JDialog
        
with a
    
running Canvas3D inside.
  I have the same behavior: after JDialog opened
free
memory decreases, and after closing the JDialog
there
is a few MBytes released, but far from that
        
initial
    
value.

 I suspected there are some Java3D threads still
running, but with my JDeveloper trace tool, I
        
could
    
not note evidence of this. The Java3D threads
        
just
    
stop running as it should be.

 Next try. I run my application with a
-verbose:class
option:
java -verbose:class myApp

 Ok. A big list of loaded classes fill up my
        
console
    
screen. Yeah, Java3D loads a lot of classes,
        
around
    
300, and they are kept in memory for future use.
This classes are not reloaded when I open the
JDialog
a second time.And opens very fast.
 As gc just take instances, and not the class
definition, that space taken by classes are not
        
full
    
released.
 Seens right to me. Just take a lot of memory.

 It is all a got.If someone knows how relase
        
more
    
memory after releasing  Java3D instances, please
share
it with us.
 Ok, have more memory is always a good option ;)

Alessandro


 --- Osama Abdalah <[EMAIL PROTECTED]>
escreveu: > Hi All,
        
Java 3D objects implemented on a JDialog are
          
not
    
cleared after closing the dialog even if i
          
used
    
cleanUp() method of SimpleUniverse , How can i
          
solve
        
this problem
               Thank you all

__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/


          
===========================================================================
  
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".
          
Yahoo! Mail - o melhor webmail do Brasil
http://mail.yahoo.com.br


        
===========================================================================
  
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".
        
__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/


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


__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

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


  

--
D'Amore Jean-Robert
IT Systems
Bell Geospace Ltd.
Unit 5A, Crombie Lodge
Aberdeen A.S.T.P
Balgownie Drive
Aberdeen AB228GU

Tel: +44(0)1224227703
Email: [EMAIL PROTECTED]

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

--
D'Amore Jean-Robert
IT Systems
Bell Geospace Ltd.
Unit 5A, Crombie Lodge
Aberdeen A.S.T.P
Balgownie Drive
Aberdeen AB228GU

Tel: +44(0)1224227703
Email: [EMAIL PROTECTED]

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