A friend of mine reports that the memory usage of the following program
grows continuously when compiled with dmd 2.060 and run on Windows 7 sp1
home premium 64 bit (also on Microsoft Windows [Version 6.1.7600]).
If you are on Windows, could you please say whether you have the same
problem. (I don't have Windows.) The following is how we reproduce:
Generate a file of about 1G by running the following program:
import std.stdio;
void foo()
{
auto file = File("one_gigabyte_file", "w");
auto data = new ubyte[](100 * 1024 * 1024);
foreach (i; 0 .. 10) {
file.rawWrite(data);
}
}
void main()
{
foo();
}
That part is not the problem. The problem is when reading such a large
file by chunks. Could you please run the following program and report
whether the memory consumption of it is increasing continuously:
import std.stdio;
void foo()
{
auto file = File("one_gigabyte_file", "r");
auto data = new ubyte[](100 * 1024 * 1024);
foreach (i; 0 .. 10) {
file.rawRead(data);
}
}
void main()
{
for (size_t i; true; ++i) {
writeln(i);
foo();
}
}
The program gets terminated by a core.exception.OutOfMemoryError. (Same
problem with std.stream.BufferedFile.)
I don't see any problem under Linux.
Thank you,
Ali