# Lower \`@returnAddress\` to a constant 0 in Emscripten release builds · gitcafe/zig

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

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

Visibility: public

Requested revision: f45f9649e3fc2aa2b6a76476f2467f02ffc7d461

Requested commit: f45f9649e3fc2aa2b6a76476f2467f02ffc7d461

Commit: f45f9649e3fc2aa2b6a76476f2467f02ffc7d461

Tree: 4d10ac814ef9d7d7e9f06fffac796217336bfbc5

Author: Carl Åstholm

Committer: Andrew Kelley

## Message

```
Lower `@returnAddress` to a constant 0 in Emscripten release builds

Emscripten currently implements `emscripten_return_address()` by calling
out into JavaScript and parsing a stack trace, which introduces
significant overhead that we would prefer to avoid in release builds.

This is especially problematic for allocators because the generic parts
of `std.mem.Allocator` make frequent use of `@returnAddress`, even
though very few allocator implementations even observe the return
address, which makes allocators nigh unusable for performance-critical
applications like games if the compiler is unable to devirtualize the
allocator calls.

```

## Parents

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

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