post, Jan 15, 2026, on Mitja Felicijan’s blog

What -fsanitize=address does

  • Enables AddressSanitizer (ASan): a compile and link time instrumentation plus runtime library that detects memory errors.
  • Detects: out-of-bounds accesses (heap, stack, globals), use-after-free, some use-after-return, double/invalid free, and (on some platforms) leaks.
  • How it works: instrumented memory accesses are checked against a shadow memory; violations produce an error report with a stack trace and abort the program.
  • Trade-offs: ~2x runtime slowdown (varies), higher memory use, large virtual address space reservation on 64-bit, and requires linking the ASan runtime (not suitable for production builds).
  • Usage: compile and link with -fsanitize=address ...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help