# Killed VS OutOfMemoryError()

**URL:** https://discourse.julialang.org/t/killed-vs-outofmemoryerror/129716
**Category:** General Usage
**Tags:** memory, education
**Created:** [June 6, 2025, 9:47pm UTC](https://discourse.julialang.org/t/killed-vs-outofmemoryerror/129716 "2025-06-06T21:47:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)
#### Post date: [June 6, 2025, 9:47pm UTC](https://discourse.julialang.org/t/killed-vs-outofmemoryerror/129716/1 "2025-06-06T21:47:02Z")

</div>

Why we have two different error messages? What is the difference between `Killed` and `OutOfMemoryError()` messages?

```julia
julia> A = fill(2, 5000000000)
ERROR: OutOfMemoryError()

slightly lower:
julia> A = fill(2, 4000000000)
Killed

```

I saw above example in this post [How to track total memory usage of Julia process over time - #15 by Palli](https://discourse.julialang.org/t/how-to-track-total-memory-usage-of-julia-process-over-time/91167/15). What is the purpose of having two different messages for memory shortage?

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [June 6, 2025, 9:56pm UTC](https://discourse.julialang.org/t/killed-vs-outofmemoryerror/129716/2 "2025-06-06T21:56:36Z")

</div>

> [@raman\_kumar](#):
>
> What is the purpose of having two different messages for memory shortage?

There aren’t two different messages in Julia, it’s only one:

- [`OutOfMemoryError()`](https://docs.julialang.org/en/v1/base/base/#Core.OutOfMemoryError) is a Julia error which indicates that you tried to allocate an object which Julia was able to determine would use too much memory, and it prevented you from doing it
- `Killed` is a message from your operating system to inform you that it terminated the Julia process.

---

<div class="post-metadata">

### Author: ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)
#### Post date: [June 7, 2025, 1:55am UTC](https://discourse.julialang.org/t/killed-vs-outofmemoryerror/129716/3 "2025-06-07T01:55:55Z")

</div>

There is a 3rd option when neither Julia nor the operating system notices you overdid it on memory allocation and stops you in time: the entire machine freezes or shuts down.
