my dog learned polymorphism*
The moose likes Performance and the fly likes does gc return memory to operation system? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "does gc return memory to operation system?" Watch "does gc return memory to operation system?" New topic
Author

does gc return memory to operation system?

w jc
Greenhorn

Joined: Oct 25, 2004
Posts: 3
I'm novice, if my question is too simple or strange to answer, forgive me.

I engaged a project developed by swing, and configure -Xms32m and -Xmx64m as project maximum memeory for jvm. when i open some frames contains
some Jpanel contiunally, the window's taskmanager show memory occupied by javaw rise again and again.
my question is: since jvm start with -Xms32m, it should have has enough memory for some frames, why malloc from operation system?
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
First, if you are using Windows Task Manager to look at memory usage, be sure to use the "VM Size" column. The "Mem Usage" column can be confusing, as it relates to physical memory.

Second, even when looking at VM Size column, this is telling you about all memory used by the JVM. The Java heap is only one part of that memory. There is additional memory for the JVM's implementation code, loaded Java classes and a variety of other non-heap resources.

In your particular application, I would be surprised if Java was actually increasing the heap size from the initial 32 Mbytes. If it is, then I suspect that either your application is more complicated than you suggest or you have a leak.

To find out whether your application really is increasing the heap size, try setting the maximum heap to 32 Mbytes as well. If the application runs OK and the VM Size is similar to before, then any observed memory consumption increase is due to things other than Java heap.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
w jc
Greenhorn

Joined: Oct 25, 2004
Posts: 3
hi,Peter Chase
thanks for your reply.

the phenomenon i talked last article is based on IBM JDK1.3, then i
replace it with SUN JDK 1.4, the strange phenomenon disappeared.

Suppose IBM modified System.gc()? any way to solve this question which
my project must run with IBM JDK1.3?
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
System.gc() isn't guaranteed to do anything, so it might well be that the IBM implementation differs significantly from Sun's.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
 
subject: does gc return memory to operation system?
 
Similar Threads
StackOverflowError
JBoss Memory Management
How to limit the size of a object in terms of MB ?
Memory Control
Does Java Garbage Collector free the unused memory