# std: use sigaltstack for default segfault handler · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/85cac9e5b6c3039537e87247f8640f7182df8540)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 85cac9e5b6c3039537e87247f8640f7182df8540

Requested commit: 85cac9e5b6c3039537e87247f8640f7182df8540

Commit: 85cac9e5b6c3039537e87247f8640f7182df8540

Tree: 378eaba88621711544e645f6c5287c788f3ce222

Author: Matthew Lugg

Committer: mlugg

## Message

```
std: use sigaltstack for default segfault handler

This allows stack overflows to print stack traces. The size of the
sigaltstack (and whether it is actually set) can be configured by
setting `std.Options.signal_stack_size`.

The default value for the signal stack size was chosen experimentally by
doubling the value required to get stack traces on stack overflow with
the self-hosted x86_64 backend. While some targets may typically use
more stack space than x86_64-linux, the self-hosted x86_64 backend is
quite wasteful with stack at the moment, making it a fair benchmark.
Executables produced by the LLVM backend should have lower stack usage.

```

## Parents

- [be84d7cb9bdbf8a1a4212f10c1dfdc437af0532c](https://git.cafe/gitcafe/zig/commit/be84d7cb9bdbf8a1a4212f10c1dfdc437af0532c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/85cac9e5b6c3039537e87247f8640f7182df8540?format=markdown)
