Is there any reasons to not use "mmap" to read files?

Florian Weimer fw at deneb.enyo.de
Sun Feb 13 12:55:43 UTC 2022


One issue that hasn't been mentioned so far is that if the input 
file is truncated, accessing is memory-mapped view results in 
`SIGBUS` on Linux and other systems. (I think Windows prevents 
truncation instead.)

In theory, it is possible to intercept that signal and turn it 
into something else (Java does that), but I don't think the [D 
implementation](https://github.com/dlang/phobos/blob/master/std/mmfile.d) does that.


More information about the Digitalmars-d mailing list