# Track memory usage

**URL:** <https://discourse.julialang.org/t/track-memory-usage/52158>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 21, 2020, 8:34am UTC](https://discourse.julialang.org/t/track-memory-usage/52158 "2020-12-21T08:34:05Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![mike\_k](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike_k/32/211864_2.png) [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Post date:** [December 23, 2020, 2:29pm UTC](https://discourse.julialang.org/t/track-memory-usage/52158/15 "2020-12-23T14:29:28Z")

</div>

Hi, I avoid `OutOfMemory` errors with the function described [here](https://discourse.julialang.org/t/outofmemoryerror-instead-of-allocating-too-much-resources-in-the-job-scheduler/45575/4). This works for me on a Linux machine. I frequently call it (in my case in JuMP callbacks), and abort my program if the memory consumption reaches my predefined limit. You can, however, clearly write the return values to a \*.log file.  
Note that the function returns the current memory usage of your program, not of specific variables. Maybe this helps anyway.

---

_[View the full topic](https://discourse.julialang.org/t/track-memory-usage/52158)._
