2

I need to monitor:

  • physical memory
  • swap memory
  • virtual memory

for the current process. Total and available (free).

Physical and swap I acquire with no problems whatsoever using sysinfo stucture, I can get used virtual memory from e.x. /proc/self/statm...

...but I still need total and/or free virtual memory for the current process. How to accomplish this?

This is purely Linux related question (in Win it's easy). Used distros: Ubuntu, Fedora.

EDIT: Maybe it will be easier to understand my question, when I say that I'm trying to acquire equivalent of ullTotalVirtual and ullAvailVirtual from Windows MEMORYSTATUSEX structure from GlobalMemoryStatus() on Linux systems.

MKK
  • 130
  • 10
  • 2
    possible duplicate of [How to measure actual memory usage of an application or process?](http://stackoverflow.com/questions/131303/how-to-measure-actual-memory-usage-of-an-application-or-process) – m.s. Jun 02 '15 at 09:56
  • Please read carefully instead of giving random links. I DO HAVE actual virtual memory usage. What I need is total virtual memory for the process (free + used) or available virtual memory for the process (free). – MKK Jun 02 '15 at 10:06
  • What does "free virtual memory for the process" mean? Slack space in internal allocators? Overcommitted mmap address space? What? – Useless Jun 02 '15 at 10:38
  • `ullAvailVirtual` `The amount of unreserved and uncommitted memory currently in the user-mode portion of the virtual address space of the calling process, in bytes.` – MKK Jun 02 '15 at 10:59

1 Answers1

-1

Some weeks ago a published the following tiny library: https://sourceforge.net/projects/meminfo/

Maybe it helps solving your problem

Thomas Sparber
  • 2,827
  • 2
  • 18
  • 34
  • Unfortunately it's about memory usage as well, which is NOT what I'm looking for. It uses `/proc/self/smaps`. – MKK Jun 02 '15 at 10:17
  • So what exactly are you looking for then? You wrote physical, swap and virtual Memory for the current process. – Thomas Sparber Jun 02 '15 at 10:25
  • 1
    It's not an easy question, so carefully reading question is a really important thing. I wrote in question: _but I still need total and/or free virtual memory for the current process. How to accomplish this?_ – MKK Jun 02 '15 at 10:27
  • @MKK It's been quite some time, had you found your answer for this? I am looking for the same but couldn't find anything on total and/or free virtual memory for the current process on web. – ZoomIn Dec 14 '20 at 05:59