on 05-27-2006 6:07 AM
Hi,
I need to get the size of the RAM using java program.Send me the way of doing it.if possible send me sample code.
Regards,
kiran.
Hi
Check here
http://jakarta.apache.org/commons/io/api-release/org/apache/commons/io/FileSystemUtils.html
Cheers
Jawahar Govindaraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
private static long getMemory() {
gc();
long totalMemory = Runtime.getRuntime().totalMemory();
gc();
long freeMemory = Runtime.getRuntime().freeMemory();
long usedMemory = totalMemory - freeMemory;
return usedMemory;
}
Regards,
Piyush
ps: please mark useful answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kiran,
See JavaDocs for java.lang.Runtime class, related methods are:
Runtime.getRuntime().freeMemory();
Runtime.getRuntime().maxMemory();
Runtime.getRuntime().totalMemory();
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.