# How to check how free RAM is available?

**URL:** <https://discourse.julialang.org/t/how-to-check-how-free-ram-is-available/15288>\
**Category:** General Usage\
**Created:** [September 21, 2018, 3:26pm UTC](https://discourse.julialang.org/t/how-to-check-how-free-ram-is-available/15288 "2018-09-21T15:26:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)\
**Post date:** [September 21, 2018, 3:26pm UTC](https://discourse.julialang.org/t/how-to-check-how-free-ram-is-available/15288/1 "2018-09-21T15:26:43Z")

</div>

How to check how free RAM is available ? Is any call in Julia ? Paul

---

<div class="post-metadata">

**Author:** ![Andrey.Borzunov](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Andrey.Borzunov](https://discourse.julialang.org/u/Andrey.Borzunov)\
**Post date:** [September 21, 2018, 3:37pm UTC](https://discourse.julialang.org/t/how-to-check-how-free-ram-is-available/15288/2 "2018-09-21T15:37:45Z")

</div>

You can use your system routines.  
If you are at unix-like:

```julia
run(`egrep --color 'Mem|Cache|Swap' /proc/meminfo`)

```

---

<div class="post-metadata">

**Author:** ![ksmcreynolds](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ksmcreynolds/32/860_2.png) [@ksmcreynolds](https://discourse.julialang.org/u/ksmcreynolds)\
**Post date:** [September 21, 2018, 3:52pm UTC](https://discourse.julialang.org/t/how-to-check-how-free-ram-is-available/15288/3 "2018-09-21T15:52:43Z")

</div>

From Julia, you can use `Sys.free_memory()` which returns an unsigned integer with number of bytes that are free. If you want it in e.g. MiB do `Sys.free_memory()/2^20`. You can also get it by calling `versioninfo(verbose=true)` although that prints a lot of other info as well.

Note: `versioninfo()` is a part of InteractiveUtils in the Standard Library which is loaded automatically in the REPL. If you want to run it from a script you need to include `using InteractiveUtils` before calling it.

---

<div class="post-metadata">

**Author:** ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)\
**Post date:** [September 21, 2018, 4:51pm UTC](https://discourse.julialang.org/t/how-to-check-how-free-ram-is-available/15288/4 "2018-09-21T16:51:01Z")

</div>

THX, is not easy to find it  
[Search · The Julia Language](https://docs.julialang.org/en/v1/search/?q=free+memory) 🙂  
Paul  
W dniu 2018-09-21 o 17:57, Kevin McReynolds pisze:

---

<div class="post-metadata">

**Author:** ![Michal](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Michal](https://discourse.julialang.org/u/Michal)\
**Post date:** [August 6, 2021, 8:33am UTC](https://discourse.julialang.org/t/how-to-check-how-free-ram-is-available/15288/5 "2021-08-06T08:33:08Z")

</div>

Total RAM memory:  
Sys.total\_memory()/2^20

Free RAM memory:  
Sys.free\_memory()/2^20

@ksmcreynolds How can we get available RAM memory?

---

<div class="post-metadata">

**Author:** ![henry2004y](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henry2004y/32/9284_2.png) [@henry2004y](https://discourse.julialang.org/u/henry2004y)\
**Post date:** [October 9, 2021, 9:04am UTC](https://discourse.julialang.org/t/how-to-check-how-free-ram-is-available/15288/6 "2021-10-09T09:04:00Z")

</div>

I have the same question. Is it possible to check system **available** memory but not **free** memory? On Linux most people suggest look at `/proc/meminfo`. Since free RAM is treated as “wasted” RAM, why is there a built-in method for free memory but not available memory?

---

<div class="post-metadata">

**Author:** ![StatisticalMouse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/statisticalmouse/32/43370_2.png) [@StatisticalMouse](https://discourse.julialang.org/u/StatisticalMouse)\
**Post date:** [October 9, 2021, 10:29am UTC](https://discourse.julialang.org/t/how-to-check-how-free-ram-is-available/15288/8 "2021-10-09T10:29:30Z")

</div>

The question is pretty hard. I’ve run Julia on my mac that took 50GB RAM, and my mac has 16GB. How much was free? -30GB?

MacOS has ’memory pressure’ on the monitor app. I don’t really know what it does.

---

<div class="post-metadata">

**Author:** ![Marcell\_Havlik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marcell_havlik/32/37424_2.png) [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Post date:** [July 23, 2022, 3:01pm UTC](https://discourse.julialang.org/t/how-to-check-how-free-ram-is-available/15288/9 "2022-07-23T15:01:00Z")

</div>

Indeed, this seems strange. Didn’t the developer forgot to implement **available memory** Sys.available\_memory() when he implemented **total** & **free** memory?

---

<div class="post-metadata">

**Author:** ![Marcell\_Havlik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marcell_havlik/32/37424_2.png) [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Post date:** [July 23, 2022, 4:22pm UTC](https://discourse.julialang.org/t/how-to-check-how-free-ram-is-available/15288/10 "2022-07-23T16:22:27Z")

</div>

I made a very ugly workaround solution:  
`available_memory() = parse(Int, String(read(`grep MemAvailable /proc/meminfo`))[14:end-3])`
