http://d.puremagic.com/issues/show_bug.cgi?id=4358
Summary: Potential Memory Leaks in std.file.read() ? Product: D Version: D1 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: m...@vermi.fr --- Comment #0 from Vermi <m...@vermi.fr> 2010-06-21 10:13:49 PDT --- Created an attachment (id=668) Source file showing problem in memory managment Hi, it looks like the Garbage Collector don't free the memory used by std.file.read(). Here a simple example : [code] import std.file; import std.gc; void main() { for (int i=0; i<4096; i++) { void[] buffer = std.file.read("C:\\windows\\System32\\imageres.dll"); std.gc.fullCollect(); } } [/code] With this code I get a memory usage of ~200 MB. Now, simply change it with : [code] import std.file; import std.gc; void main() { for (int i=0; i<4096; i++) { void[] buffer = std.file.read("C:\\windows\\System32\\imageres.dll"); std.gc.fullCollect(); delete buffer; } } [/code] The memory usage is now about 20 MB. (the size of the file). It poses me a big problem with a program I'm writing, mermoy usage is rising until ~600 MB... Must I add delete everywhere in my code ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------