@@ -20,6 +20,8 @@ export BINDIR,
2020 loadavg,
2121 free_memory,
2222 total_memory,
23+ physical_free_memory,
24+ physical_total_memory,
2325 isapple,
2426 isbsd,
2527 isdragonfly,
@@ -246,19 +248,44 @@ function loadavg()
246248 return loadavg_
247249end
248250
251+ """
252+ Sys.free_physical_memory()
253+
254+ Get the total memory in RAM (including that which is currently used) in bytes. The entire
255+ amount may not be available to the current process; see `Sys.total_memory()`.
256+ """
257+ free_physical_memory () = ccall (:uv_get_free_memory , UInt64, ())
258+
259+ """
260+ Sys.total_physical_memory()
261+
262+ Get the total memory in RAM (including that which is currently used) in bytes. The entire
263+ amount may not be available to the current process; see `Sys.total_memory()`.
264+ """
265+ total_physical_memory () = ccall (:uv_get_total_memory , UInt64, ())
266+
249267"""
250268 Sys.free_memory()
251269
252270Get the total free memory in RAM in bytes.
253271"""
254- free_memory () = ccall (:uv_get_free_memory , UInt64, ())
272+ free_memory () = ccall (:uv_get_available_memory , UInt64, ())
255273
256274"""
257275 Sys.total_memory()
258276
259277Get the total memory in RAM (including that which is currently used) in bytes.
278+ This amount may be constrained, e.g., by Linux control groups. For the unconstrained
279+ amount, see `Sys.physical_memory()`.
260280"""
261- total_memory () = ccall (:uv_get_total_memory , UInt64, ())
281+ function total_memory ()
282+ memory = ccall (:uv_get_constrained_memory , UInt64, ())
283+ if memory == 0
284+ return total_physical_memory ()
285+ else
286+ return memory
287+ end
288+ end
262289
263290"""
264291 Sys.get_process_title()
0 commit comments