# In Atom, Julia exits while running a script

**URL:** <https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751>\
**Category:** Juno\
**Tags:** question\
**Created:** [March 30, 2022, 3:13pm UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751 "2022-03-30T15:13:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![drarnau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drarnau/32/4476_2.png) [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Post date:** [March 30, 2022, 3:13pm UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751/1 "2022-03-30T15:13:24Z")

</div>

Hello,

I am running quite a big optimization code (I can’t share it). The big picture is that I use a modified version of Tamas Papp’s [MultistartOptimization.jl](https://github.com/tpapp/MultistartOptimization.jl) to estimate a non-linear model.

When I increase the amount of Sobol points significantly that the optimization program uses, Julia simply collapses. The code runs seemingly without problems for a while, but then I get:

```julia
Julia has exited. Press Enter to start a new session.

```

Any idea of what might be causing this?

I tried to run the optimization with fewer points, and it works. However, when I run it on the Terminal, not in Atom, I get weird behavior irrespective of the number of points.

I updated Juno as explained [here](https://docs.junolab.org/stable/man/update/) and the problem persists.

Thanks!

---

<div class="post-metadata">

**Author:** ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)\
**Post date:** [March 30, 2022, 3:39pm UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751/2 "2022-03-30T15:39:57Z")

</div>

My first guess would be O(ut)O(f)M(emory). Could you run Julia REPL in an OS command line shell? Then you should at some point see better indications of the problem. You could also watch your system monitor w.r.t. memory workload during a program run.

---

<div class="post-metadata">

**Author:** ![drarnau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drarnau/32/4476_2.png) [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Post date:** [March 31, 2022, 9:42am UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751/3 "2022-03-31T09:42:07Z")

</div>

Thank you.

I use Ubuntu. This is what happens with memory when I run the code at a scale that does **not** induce Julia in Atom to crash:

 ![Screenshot from 2022-03-31 11-31-13](https://global.discourse-cdn.com/julialang/original/3X/e/0/e05050045874fcb0664798fcf7519c3a62f26ed8.jpeg)

I have no experience reading these, but I guess it’s telling me that RAM is almost full, so if I increase the size of the optimisation problem, I’ll run out?

Is there a way around this? I’m also running this same code on a computer with fewer cores, and I do not run into the problem of Julia in Atom crashing:

 ![Screenshot from 2022-03-31 11-40-37](https://global.discourse-cdn.com/julialang/original/3X/3/2/320ca0e0e8f626ebae42a3063514b91923922903.jpeg)

This computer seems to be managing memory much better.

Thanks!

---

<div class="post-metadata">

**Author:** ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)\
**Post date:** [March 31, 2022, 9:49am UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751/4 "2022-03-31T09:49:02Z")

</div>

> [@drarnau](#):
>
> I have no experience reading these, but I guess it’s telling me that RAM is almost full, so if I increase the size of the optimisation problem, I’ll run out?

It looks like it: both systems have 32 GB memory, on one we have 9 GB workload, on the other 24 GB. The difference is quite striking. Did you check the base load of the two systems without running your code? If the base load is similar we could have a problem. From the looks of it you also could be running different Julia versions?

---

<div class="post-metadata">

**Author:** ![drarnau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drarnau/32/4476_2.png) [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Post date:** [March 31, 2022, 9:51am UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751/5 "2022-03-31T09:51:47Z")

</div>

I haven’t checked the base load but I run Ubuntu on both and the same Julia version. These two computers do not run anything else than this code (and the OS).

Could it be that the 24-cores needs a lot of RAM to deal with 24 cores?

---

<div class="post-metadata">

**Author:** ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)\
**Post date:** [March 31, 2022, 9:56am UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751/6 "2022-03-31T09:56:29Z")

</div>

> [@drarnau](#):
>
> Could it be that the 24-cores needs a lot of RAM to deal with 24 cores?

Maybe, but not that much. I’d expect other software to be running on the 24 core system using a bit of the system resources…

Or, simplest explanation: you are using large per thread data structures. That would be something like 1 GB times 8 threads vs. 1 GB times 24 threads?

---

<div class="post-metadata">

**Author:** ![drarnau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drarnau/32/4476_2.png) [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Post date:** [March 31, 2022, 10:06am UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751/7 "2022-03-31T10:06:22Z")

</div>

> [@goerch](#):
>
> Maybe, but not that much. I’d expect other software to be running on the 24 core system using a bit of the system resources…

Looking at `htop` output, the other _big_ user of memory is Dropbox. I’ve just shut it down but I don’t think it’s going to make a difference, right?

> [@goerch](#):
>
> Or, simplest explanation: you are using large per thread data structures. That would be something like 1 GB times 8 threads vs. 1 GB times 24 threads?

Yes, the model I solve uses big arrays! So, the way out is to buy more RAM? I knew I wasn’t buying enough…

---

<div class="post-metadata">

**Author:** ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)\
**Post date:** [March 31, 2022, 10:12am UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751/8 "2022-03-31T10:12:57Z")

</div>

> [@drarnau](#):
>
> Yes, the model I solve uses big arrays! So, the way out is to buy more RAM? I knew I wasn’t buying enough…

Could be. But I don’t fully understand your problem. Take matrix multiply as an example: you can scale that to a high number of cores which all compute on different parts of the matrices without too much memory overhead. Something seems special in that all your threads need so much memory…

---

<div class="post-metadata">

**Author:** ![drarnau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drarnau/32/4476_2.png) [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Post date:** [March 31, 2022, 10:56am UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751/9 "2022-03-31T10:56:26Z")

</div>

Each thread needs to solve a dynamic programming problem (which uses big arrays) and do its own Monte Carlo experiment. That’s the nature of the model.

It’s not the case that all threads are working with shared arrays.

---

<div class="post-metadata">

**Author:** ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)\
**Post date:** [March 31, 2022, 10:59am UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751/10 "2022-03-31T10:59:32Z")

</div>

> [@drarnau](#):
>
> Each thread needs to solve a dynamic programming problem (which uses big arrays) and do its own Monte Carlo experiment. That’s the nature of the model.

Thanks for the explanation. So you have to tune the application such that number of threads times problem size fits in the available memory.

---

<div class="post-metadata">

**Author:** ![drarnau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drarnau/32/4476_2.png) [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Post date:** [March 31, 2022, 2:00pm UTC](https://discourse.julialang.org/t/in-atom-julia-exits-while-running-a-script/78751/11 "2022-03-31T14:00:21Z")

</div>

Thank you for all the helpful comments!
