I am currently hosting a java server program(craftbukkit), and it seems that when I try to get the RAM usage from the server program(craftbukkit), it doesn't return the actual used RAM, but rather somewhere around half of what it's using. (though it's not always exactly half, so it's impossible to estimate actual RAM usage this way).
I was wondering how I might go about getting the actual RAM used by the java process, as seen in the system monitor tool(on linux), this way I would be able to retrieve the amount of RAM used as reported to the system.
I saw an example previously using the PID of the process, but I don't know how to go about getting the PID of the process, knowing only the name.(only one java instance is running, so we don't have to worry about getting the wrong result)
Thanks ahead of time!
With ps -ef | grep "java" I get the following output
prodynamics@prodynamics:~$ ps -ef | grep "java"
1000 22292 29385 75 12:08 pts/0 00:42:19 java -Xmx3100M -Xms1024M -XX:MaxPermSize=248m -jar craftbukkit.jar
1000 23544 23443 0 13:04 pts/2 00:00:00 grep java
But with ps -eo pid | grep "java" The console returns no results at all. Though to my understanding it should return the PID.