On Thursday, 24 March 2016 at 13:38:32 UTC, Marc Schütz wrote:
Yes, it's read into your processes memory. You can use
std.mmfile [1] to make things a bit more efficient. It will,
too, read the data into memory, but it will do so in a way
(memory mapping) that only loads what is actually accessed
(everything in your case), and that allows the operating system
to efficiently release and reload parts of it if memory runs
low.
Unfortunately there is no example in the documentation, but it
works like this (untested):
import std.mmfile;
auto file = new MmFile(inputfile);
string text = cast(string) file[];
...
[1] http://dlang.org/phobos/std_mmfile.html
That is very clever. Thank you for the tip and I have implemented
it and it works. I feel like it is a safer way of reading a file.