c++address-sanitizer

How to enable address sanitizer at godbolt.org


I am trying to enable address sanitizer at godbolt.org with -fsanitize=address, but get error:

==3==ERROR: AddressSanitizer failed to allocate 0xdfff0001000 (15392894357504) bytes at address 2008fff7000 (errno: 12)
==3==ReserveShadowMemoryRange failed while trying to map 0xdfff0001000 bytes. Perhaps you're using ulimit -v

Example: https://godbolt.org/z/5GDtrr

How can I enable address sanitizer correctly?


Solution

  • By design Asan allocates a huge amount of virtual memory (20 Tb on x86_64 machines) at start (details here). This may be a problem if overcommit is disabled or virtual memory is limited with ulimit -v.

    In both cases there's nothing Asan can do - you'll need to raise this with Godbolt VM maintainers in https://github.com/mattgodbolt/compiler-explorer/issues