• Martin Holst Swende's avatar
    consensus/ethash: avoid runtime errors due to OOD on mmap writes (#23799) · 178debe4
    Martin Holst Swende authored
    When we map a file for generating the DAG, we do a simple truncate to e.g. 1Gb. This is fine, even if we have nowhere near 1Gb disk available, as the actual file doesn't take up the full 1Gb, merely a few bytes. When we start generating into it, however, it eventually crashes with a unexpected fault address .
    
    This change fixes it (on linux systems) by using the Fallocate syscall, which preallocates suffcient space on disk to avoid that situation. 
    Co-authored-by: 's avatarFelix Lange <fjl@twurst.com>
    178debe4
mmap_help_linux.go 1.31 KB