Hi
I have a problem, I load into an array from textfile. Textfile is 70MB. It's a simple load into an array, line by line and value by value.. no additional processing.
But when loading is done, my memory usage jumps up for 200MB!
This is how I do it:
...
assignfile(text_file,HandlerFlowsFN);
settextbuf(text_file,BufferSize);
reset(text_file);
i:=0;
SetLength(Handler_Flows,MasterHandlerFlowIndex);
while not eof(text_file) do
begin
Readln(text_file,loadtext);
Line.QuoteChar:='¨';
Line.DelimitedText:=loadtext;
Handler_Flows.A:=StrToIntDef(Line[0],0);
Handler_Flows.B:=StrToIntDef(Line[1],0);
Handler_Flows.C:=StrToIntDef(Line[2],0);
Handler_Flows.D:=Line[3];
Handler_Flows.E:=StrToIntDef(Line[4],0);
Handler_Flows.F:=Line[5];
Handler_Flows.G:=Line[6];
inc(i);
end;
FreeAndNil(Line);
CloseFile(text_file);
...
MasterHandlerFlowIndex is the number of records in file. It's 2.602.020. I also tried with incremental SetLength, first to set it to 10000 and then resetting it until it finishes, but same thing.
Anyone has any idea, why is it taking so much memory?
Is there anything I can do?
this is array :
THandler_Flow = record
A: integer;
B: integer;
C: integer;
D: string;
E: integer;
F: string;
G: string;
End;
Thanx a lot
Tilen
I have a problem, I load into an array from textfile. Textfile is 70MB. It's a simple load into an array, line by line and value by value.. no additional processing.
But when loading is done, my memory usage jumps up for 200MB!
This is how I do it:
...
assignfile(text_file,HandlerFlowsFN);
settextbuf(text_file,BufferSize);
reset(text_file);
i:=0;
SetLength(Handler_Flows,MasterHandlerFlowIndex);
while not eof(text_file) do
begin
Readln(text_file,loadtext);
Line.QuoteChar:='¨';
Line.DelimitedText:=loadtext;
Handler_Flows.A:=StrToIntDef(Line[0],0);
Handler_Flows.B:=StrToIntDef(Line[1],0);
Handler_Flows.C:=StrToIntDef(Line[2],0);
Handler_Flows.D:=Line[3];
Handler_Flows.E:=StrToIntDef(Line[4],0);
Handler_Flows.F:=Line[5];
Handler_Flows.G:=Line[6];
inc(i);
end;
FreeAndNil(Line);
CloseFile(text_file);
...
MasterHandlerFlowIndex is the number of records in file. It's 2.602.020. I also tried with incremental SetLength, first to set it to 10000 and then resetting it until it finishes, but same thing.
Anyone has any idea, why is it taking so much memory?
Is there anything I can do?
this is array :
THandler_Flow = record
A: integer;
B: integer;
C: integer;
D: string;
E: integer;
F: string;
G: string;
End;
Thanx a lot
Tilen