# Why is the memory blowing up in this multi-threaded code?

**URL:** <https://discourse.julialang.org/t/why-is-the-memory-blowing-up-in-this-multi-threaded-code/22680>\
**Category:** General Usage\
**Created:** [April 3, 2019, 8:25am UTC](https://discourse.julialang.org/t/why-is-the-memory-blowing-up-in-this-multi-threaded-code/22680 "2019-04-03T08:25:58Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [April 4, 2019, 9:11am UTC](https://discourse.julialang.org/t/why-is-the-memory-blowing-up-in-this-multi-threaded-code/22680/21 "2019-04-04T09:11:44Z")

</div>

So you’re saying that if you look at htop for Julia and for Python/Numba you see that the memory use is higher for Julia? Or are you comparing htop for Python with `@benchmark` for Julia? because that makes no sense.

32GB is probably the total memory consumption for both, it’s just a question of how much is in use at any moment.

---

<div class="post-metadata">

**Author:** ![ruthmarx1](https://avatars.discourse-cdn.com/v4/letter/r/ecd19e/32.png) [@ruthmarx1](https://discourse.julialang.org/u/ruthmarx1)\
**Post date:** [April 4, 2019, 9:17am UTC](https://discourse.julialang.org/t/why-is-the-memory-blowing-up-in-this-multi-threaded-code/22680/22 "2019-04-04T09:17:28Z")

</div>

I’m looking at the RES memory in htop, for both. The memory use is higher for Julia. I can’t get the equivalent @benchmark stats for Numba.

---

<div class="post-metadata">

**Author:** ![ruthmarx1](https://avatars.discourse-cdn.com/v4/letter/r/ecd19e/32.png) [@ruthmarx1](https://discourse.julialang.org/u/ruthmarx1)\
**Post date:** [April 4, 2019, 10:24am UTC](https://discourse.julialang.org/t/why-is-the-memory-blowing-up-in-this-multi-threaded-code/22680/23 "2019-04-04T10:24:58Z")

</div>

I suspect it had something to do with `objs.data`. If I set `dfs = objs.data` at the start, and then iterate `for df in dfs`, I don’t see the memory jump multiples during the parallel loop.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [April 4, 2019, 10:52am UTC](https://discourse.julialang.org/t/why-is-the-memory-blowing-up-in-this-multi-threaded-code/22680/24 "2019-04-04T10:52:08Z")

</div>

That sounds likely. What sort of data structures are `objs` and `objs.data`? That has not been clear, really.

[Previous page](https://discourse.julialang.org/t/why-is-the-memory-blowing-up-in-this-multi-threaded-code/22680.md?page=1)
