Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

memory not releasing

 
Eric Braun
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a pretty complicated swing application that is eating up memory. We found some memory issues, but still have this remaining. We allocate 128mb of RAM to the heap. We see the garbage collector doing the work from 20 to 127mb because the the memory will go up and down. Once we hit the 128mb size, the memory never goes down and just stays there. The only way we can clear it out is to restart the swing application.

Any ideas? Thanks in advance!
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you using to determine the use of memory?

If you are using from the operating system it's expected that you will see the heap grow to 128 and stay there. The reason is that the gc will reclaim memory, but that memory is generally saved within the JVM and not returned to the system. If you are not having OutOfMemory errors and not having performance problems I wouldn't worry about it.

On the other hand if you are using some tool to see the heap usage of the JVM I would get a profiler and start looking for where the memory is going.
 
Eric Braun
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, we are wathinc the cpu system resources and we are experiencing OutOfMemory issues.

If we let them open too many jPanels (each one is taking a good chunk of memory), they get the OutOfMemory. If we limit them to a predefined amout of JPanels, then we eliminate the memory error.

Also, do you know if the inner classes used for the swing objects actually get destroyed when the class is destroyed? I am wondering if I create a class for each form that holds the inner classes and then manually destroy that class, if that will give up memory?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic