title: Total/Free virtual memory for a single process in Linux
body: <p>I need to monitor:</p>
  
  <ul>
  <li>physical memory</li>
  <li>swap memory </li>
  <li>virtual memory </li>
  </ul>
  
  <p>for the current process. Total and available (free).</p>
  
  <p>Physical and swap I acquire with no problems whatsoever using <code>sysinfo</code> stucture, I can get used virtual memory from e.x. <code>/proc/self/statm</code>...</p>
  
  <blockquote>
    <p>...but I still need total and/or free virtual memory <strong>for the current process</strong>. How to accomplish this?</p>
  </blockquote>
  
  <p>This is purely Linux related question (in Win it's easy). Used distros: Ubuntu, Fedora.</p>
  
  <blockquote>
    <p>EDIT:
    Maybe it will be easier to understand my question, when I say that I'm trying to acquire equivalent of <code>ullTotalVirtual</code> and <code>ullAvailVirtual</code> from <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa366770(v=vs.85).aspx" rel="nofollow">Windows MEMORYSTATUSEX structure</a> from <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx" rel="nofollow">GlobalMemoryStatus()</a> on Linux systems.</p>
  </blockquote>