Are you sure about that? If you’re thinking about Max. RSS, it’s not actually current RSS, but whatever was Max. at some point in the past. I.e. it must only go up. RSS from
meminfo_procfs seems to only go up until some pressure is applied. I didn’t see RSS go down unless I put memory pressure on some other process, and then only by down by 1-180.680/292.375 = 38%. I was trying to allocate as much memory as could in a different Julia process (I think I went pretty close to the max I could). Going to high I got:
julia> A = fill(2, 5000000000)
julia> A = fill(2, 4000000000)
I’m not sure what the kernel does, it could always take memory from you, at least swap out from the unused part at the end of your memory allocation. I’m not sure if can look at holes in you heap. I guess it must infer those, the fragmentation, from your memory usage.
Just after starting Julia:
julia> Sys.maxrss()/1000/1000 # likely because starting up, processing (the default) sysimage uses a lot of mem.:
julia> Sys.maxrss()/1000/1000 # interesting "mem use" actually went up, but I guess actual max (which is not possible to query?) only temporarily:
RSS is the Resident Set Size and is used to show how much memory is allocated to that process and is in RAM. It does not include memory that is swapped out. […] It does include all stack and heap memory.
VSZ is the Virtual Memory Size. It includes all memory that the process can access, including memory that is swapped out, memory that is allocated, but not used, and memory that is from shared libraries.
Sys.maxrss() uses getrusage (on Linux) according to its help, it actually does
ccall(:jl_maxrss, Csize_t, ()) and I see:
In most systems, processes has only two valid values:
Just the current process.
All child processes (direct and indirect) that have already terminated.
I suppose RUSAGE_SELF is used, but RUSAGE_CHILDREN might also be good info (on a cluster). Also this what I though impossible to do (all threads in a process share memory space, so while they could track their own allocations, I thought the kernel couldn’t know about that, maybe I misunderstand what this is about):
RUSAGE_THREAD (since Linux 2.6.26)
Return resource usage statistics for the calling thread.
What is this, it has no help string:
gc_num.allocd + gc_num.deferred_alloc + gc_num.total_allocd
Is that total ever allocated?
total_allocd ::Int64 # GC internal
gc_num() = ccall(:jl_gc_num, GC_Num, ())
# This type is to represent differences in the counters, so fields may be negative