Python's resource module allows getting and setting various system resource usage information. In particular, the amount of memory used by a process is available via resource.RLIMIT_VMEM
(or, on some systems, resource.RLIMIT_AS
as per this StackOverflow answer).
When I run the following Python code (using Python 3.7) to print the memory usage, I see a tuple with two values:
import resource
print(resource.getrlimit(resource.RLIMIT_AS))
On Ubuntu 18.04, it prints (-1, -1)
(which I interpret to mean, both values are infinite).
On Mac OS X 10.4, it prints (9223372036854775807, 9223372036854775807)
(which is approximately an exabyte worth of bytes).
I have two questions about this output:
What is the difference between the first number and the second number?
How should the reported values like
9223372036854775807
be interpreted - are they numbers of bytes? (Is a very large value just a way of setting a memory limit that is so large it will never be reached?)