Home > Back-end >  Delphi Tfilestream read/write file prompt system resources
Delphi Tfilestream read/write file prompt system resources

Time:09-27

Code:
Try
Fstream:=TFileStream. Create (FFileName fmOpenWrite or fmShareDenyNone);
Fstream. Position:=0;
If IsReplace then
Fstream. Seek (Fstream. Size - sizeof (tmpwInfo), soBeginning)
The else
Fstream. Seek (Fstream. Size, soBeginning);
Fstream. Write (tmpwInfo, SizeOf (tmpwInfo));
Result:=True;
Except,
end;
Fstream. Free;

Also didn't see no problem running remote memory footprint on the rise, everything is normal, seems to be representation, however, when running for one hundred thousand times, the system prompt system resources, but the memory also no point, task manager shows memory just also 40 ~ 50%, run down, again will prompt out of memory, and then thread is suspended, read and write files are about 40 m, there is no large files, have ace to help me analyse? urgent

CodePudding user response:

Can read and write 100000 times, that no problem with the code, may be a system memory errors,
The solution, can through the termination of the main thread, to solve,
  • Related