mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 06:30:28 +03:00
std.md5: Lower buffer size in mdFile example
When trying to use the function from the example as-is on a large directory tree, the D program will quickly run out of memory due to false pointers on 32-bit machines (File.byChunk will allocate a new buffer for every file).
This commit is contained in:
parent
b93e9c9fd4
commit
ffd3752a2e
1 changed files with 1 additions and 1 deletions
|
@ -49,7 +49,7 @@ void mdFile(string filename)
|
|||
|
||||
MD5_CTX context;
|
||||
context.start();
|
||||
foreach (buffer; File(filename).byChunk(4096 * 1024))
|
||||
foreach (buffer; File(filename).byChunk(64 * 1024))
|
||||
context.update(buffer);
|
||||
context.finish(digest);
|
||||
writefln("MD5 (%s) = %s", filename, digestToString(digest));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue