From ffd3752a2ee242b79a1b10c5c9402a1674638da2 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sat, 31 Mar 2012 20:02:07 +0300 Subject: [PATCH] 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). --- std/md5.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/std/md5.d b/std/md5.d index 901dc3e2c..23bf9b3fd 100644 --- a/std/md5.d +++ b/std/md5.d @@ -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));