# When my script crashes in REPL does GC also crash?

**URL:** https://discourse.julialang.org/t/when-my-script-crashes-in-repl-does-gc-also-crash/14482
**Category:** General Usage
**Created:** [September 3, 2018, 1:54pm UTC](https://discourse.julialang.org/t/when-my-script-crashes-in-repl-does-gc-also-crash/14482 "2018-09-03T13:54:50Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![LeoK987](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leok987/32/4880_2.png) [@LeoK987](https://discourse.julialang.org/u/LeoK987)
#### Post date: [September 3, 2018, 1:54pm UTC](https://discourse.julialang.org/t/when-my-script-crashes-in-repl-does-gc-also-crash/14482/1 "2018-09-03T13:54:50Z")

</div>

So, I noticed that if my script crashes, and I need to make changes and rerun the script inside the REPL, after some time, julia’s memory usage goes up, and at some point I have to restart the REPL

So, does GC crashes with my script then?

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [September 3, 2018, 2:02pm UTC](https://discourse.julialang.org/t/when-my-script-crashes-in-repl-does-gc-also-crash/14482/2 "2018-09-03T14:02:20Z")

</div>

No. Unless it’s actually crashed rather than just an error, which I assume is what you mean.

There are unfreeable memory though, mostly related to modules, types and methods.

---

<div class="post-metadata">

### Author: ![LeoK987](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leok987/32/4880_2.png) [@LeoK987](https://discourse.julialang.org/u/LeoK987)
#### Post date: [September 3, 2018, 2:08pm UTC](https://discourse.julialang.org/t/when-my-script-crashes-in-repl-does-gc-also-crash/14482/3 "2018-09-03T14:08:43Z")

</div>

So, it must be the unfreeable memory then. I have some types that are fairly large. It seems after some of these interrupted reruns the memory goes up pretty quickly. But with successful reruns, memory tends to be fairly stable. How come the unfreeable memory gets freed then?

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [September 3, 2018, 2:25pm UTC](https://discourse.julialang.org/t/when-my-script-crashes-in-repl-does-gc-also-crash/14482/4 "2018-09-03T14:25:36Z")

</div>

Large types shouldn’t be an issue. Large function could be slightly worse but shouldn’t be too bad. As far as unfreeable memory / GC is concerned, error or not shouldn’t make much difference other than following different code paths.

There are many possibilities for error to consume more memory. Most likely is external libraries not freeing up stuff. Impossible to tell without more detail.

---

<div class="post-metadata">

### Author: ![LeoK987](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leok987/32/4880_2.png) [@LeoK987](https://discourse.julialang.org/u/LeoK987)
#### Post date: [September 3, 2018, 2:30pm UTC](https://discourse.julialang.org/t/when-my-script-crashes-in-repl-does-gc-also-crash/14482/5 "2018-09-03T14:30:29Z")

</div>

I know it’s quite impossible to tell, and that baffles me too.

By external libraries, do you mean the outside packages I import?

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [September 3, 2018, 3:06pm UTC](https://discourse.julialang.org/t/when-my-script-crashes-in-repl-does-gc-also-crash/14482/6 "2018-09-03T15:06:57Z")

</div>

Things that you didn’t load/read certainly won’t have an effect on the memory consumption.

I just mean anything that allocate memory that’s not directly managed by julia.
