halting problem :)
Jarrett Billingsley
jarrett.billingsley at gmail.com
Tue Jan 27 07:27:53 PST 2009
On Tue, Jan 27, 2009 at 10:14 AM, Saaa <empty at needmail.com> wrote:
> My program doesn't exit..
>
> void main()
> {
>
> ..
> Data data[]
>
> createData(data);
> //This proces takes a minute or two.
> //data now holds about 700000 Data elements
>
> writefln(`Creating buffer`);
> ubyte[] buffer;
> for (int i=0; i<data.length; i++)
> {
> buffer~=format(data[i].net,`,`,data[i].name,`,`,to!(int[])(data[i].output),`,`,to!(int[])(data[i].input),newline);
> //This takes like a minute and has a peak memory usage of 680MB
> }
>
> writefln(`Writing file`);
> std.file.write(outFilename, buffer);
> writefln(`Writing file finished`);
>
> //The file is readily made and delta memory usage shows a few a few times
> around 20MB
> //but the program doesn't stop, although 'Writing file finished' is shown.
> //there is no static this or alike.
> //and after 10 minutes the memory usage is about 370MB and slowly going up
> //ctrl-c doesn't work anymore as well
> }
Bug in the GC?
I suppose my question would be why you're generating that huge buffer
in memory instead of just writing it all out to the file in the first
place. Use a std.stream.BufferedFile.
More information about the Digitalmars-d-learn
mailing list