← Back to list

The Default Philosophy when OOM

The default behavior is:

Cyber Gee · 2025-10-27 02:56 · 0 claps · 0.6 min read
#rust #oom
Open on Medium ↗
Wiki topics: PHI · Philosophy

The Default Philosophy when OOM

The default behavior is:

Rust’s default memory allocation philosophy is to abort (crash) on OOM, not to attempt recovery. This aligns with Rust’s goals of:

  • Safety: No undefined behavior or silent corruption.
  • Simplicity: No implicit error handling for allocations that rarely fail in practice.
  • Performance: Avoid the cost of checking every allocation for Result.

So, when an allocation fails (for example, Vec::push() needs to grow and malloc fails), Rust’s standard library calls the global OOM handler, which by default terminates the program (usually via abort()).


메타데이터
post_id
2b06c71ed835
slug
the-default-philosophy-when-oom-2b06c71ed835
url
https://medium.com/@CyberGee/the-default-philosophy-when-oom-2b06c71ed835
canonical_url
https://medium.com/@CyberGee/the-default-philosophy-when-oom-2b06c71ed835
author_url
https://medium.com/@CyberGee
status
ok
fetched_at
2026-06-12 18:14:10