title: Get memory used by a process java
body: <p>I know this question is a frequently one, however I checked some solutions from this site, but it seems like it didn't work for me.</p>
  
  <p>So, I have written a small java program, and I want to know how much memory it consumes at different execution moments. I tried Runtime.getRuntime.total() and Runtime.getRuntime.free(), but I'm getting the (almost) same results each time.</p>
  
  <p>I am not interested in how much memory is there available or used by the entire JVM, I want to know specifically for my java process.</p>