>: Unix uses virtual memory ...
>: --
>: _______________________
>: Blue Skies - Michael T.
>: _______________________
>I know, but that still does not answer the original question.
>I really don't care if the consumed memory is in physical of virtual
>address space, I'm just need a system call that will return the amount
>of used memory resources.
In some systems like Linux, the superuser can add virtual memory on
the fly by creating more swap partitions or swap files even as the
operating system is running. Conversely, the superuser can remove
swap areas.
Moreover, other processes are allocating and freeing storage concurrently
to the execution of your process.
Hence any number you obtain about the present state of affairs will
likely be hopelessly out of date by the time you use it.
In the olden days of 8 bit micros and early PC's, it was important for
applications to report available memory and disk space to the user. For one
thing, the systems were mono-tasking; once the application grabbed control of
the computer, there was no other way to interact with the computer other than
through that application. Hence applications had to incorporate some system
administration functions such as file management, and reporting on disk space
and memory usage.
In a modern operating system, the user can determine and manage the available
resources independently of the application using the system's specific tools
for that purpose. Hence you no longer have to incorporate low resource
``alarms'' or ``memory remaining'' displays; just worry about writing
the application so that it consumes as little memory as it needs to
get the job done.