• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Memory Errors and Swing/AWT

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I make sure that my unused Components are being destroyed by the garbage collector? I keep getting an out of memory error after I make a few panels containing a large image. Each time, I overwrite the old panel with the new image. However, I suspect that the old panels are not being garbage collected due to some sort of reference being held by the windowing system.
Any advice?
 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How much memory do you have?
Garbage Collection cannot be forced.
 
Micah Wedemeyer
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 256mb of physical ram and a pagefile size of 512.
If I call the JVM with the parameters:
-mx128m -ms128m
then it runs a little more before crashing out, so I know it is a memory leak in there somewhere.
I'm pretty sure it has to do with the creation and destruction of windows.
Micah
 
Frank Hale
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your code so I can try to duplicate your error?
 
Micah Wedemeyer
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really. It's long, complicated, and involves input files.
It is not too important since I am not using it for anything long term. I can generate the images one-by-one, then save them to disk for viewing. I just wanted to be able to do it all at once.
Thanks for trying.
Sigh...
Micah
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!