[Issue 1980] memory allocated via double[][] is not being freed by the GC
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 8 16:57:56 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1980
------- Comment #1 from markusle at gmail.com 2008-04-08 18:57 -------
Below is a complete piece of code that still exhibits this
issue. The file "data_random.dat" simply contains a single
row of random ints (about 30M filesize). Each iteration
allocated additional heap and I don't seem to be able to
free foo no matter what.
import std.stream;
import std.stdio;
import std.contracts;
import std.gc;
double[][] parse(BufferedFile inputFile)
{
double[][] array;
foreach(char[] line; inputFile)
{
double[] temp;
foreach(string item; std.string.split(assumeUnique(line)))
{
temp ~= std.string.atof(item);
}
array ~= temp;
}
/* rewind for next round */
inputFile.seekSet(0);
return array;
}
int main()
{
BufferedFile inputFile = new BufferedFile("data_random.dat");
while(1)
{
double[][] foo = parse(inputFile);
}
return 1;
}
--
More information about the Digitalmars-d-bugs
mailing list