# High Memory Usage when using offline\_run from Agents.jl in for loops

**URL:** <https://discourse.julialang.org/t/high-memory-usage-when-using-offline-run-from-agents-jl-in-for-loops/107731>\
**Category:** Modelling & Simulations\
**Tags:** question, memory, agents\
**Created:** [December 17, 2023, 10:33am UTC](https://discourse.julialang.org/t/high-memory-usage-when-using-offline-run-from-agents-jl-in-for-loops/107731 "2023-12-17T10:33:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Tortar](https://avatars.discourse-cdn.com/v4/letter/t/6bbea6/32.png) [@Tortar](https://discourse.julialang.org/u/Tortar)\
**Post date:** [December 18, 2023, 1:37am UTC](https://discourse.julialang.org/t/high-memory-usage-when-using-offline-run-from-agents-jl-in-for-loops/107731/2 "2023-12-18T01:37:43Z")

</div>

Indeed I tried to run your MWE and calling `GC.gc()` inside the loop solves the issue. This to me indicates that probably the issue is related more to the internal handling of garbage collection in Julia, than a particular problem with Agents.jl itself, but I could be wrong. This seems somewhat similar to [Different memory usage under Windows and linux?](https://discourse.julialang.org/t/different-memory-usage-under-windows-and-linux/105984) in spirit, so I would suggest to try it out on 1.10-rc2. Maybe it will magically work better as in that other thread 😄

---

_[View the full topic](https://discourse.julialang.org/t/high-memory-usage-when-using-offline-run-from-agents-jl-in-for-loops/107731)._
