This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Hi Zhao Xin, There are some methods in class Runtime about this. Susilo
Joined: Jan 19, 2003
Hi: my question is down java totalmemory(no freememory)? In my program ,i use manay memory . the java totalmemory raise very big .When i use System.gc(),the java freememory is down,but java totalmemory is not down.The OS memory is old OS memory add java totalmemory . How to down java totalmemory? This can down OS memory. Thanks
Hi Zhao, When the JVM is launched, the host operating system allocates an amount of memory to it. I understand that you want to change this amount of memory, from within the JVM, while it is running. If this is the case, I don't think it can be done in pure java. You would most probably have to do this via JNI and the host operating system services. While researching a similar topic, I found that your question has been asked several times already in the various java forums and newsgroups, but I failed to find an adequate response. Therefore, there's not much more I can offer you, sorry :-( Hope this has helped you, anyway. Good Luck, Avi.