How can I use a large file in Delphi? -


when use large file in memorystream or filestream see error "out of memory" how can solve problem?

example:

procedure button1.clıck(click); var   mem:tmemorystream;   str:string; begin   mem:=tmemorystream.create;   mem.loadfromfile('test.txt');----------> there test.txt size 1 gb..   compressstream(mem); end; 

your implementation messy. don't know compressstream does, if want deal large file stream, can save memory using tfilestream instead of trying read whole thing tmemorystream @ once.

also, you're never freeing tmemorystream when you're done it, means you're going leak whole lot of memory. (unless compressstream takes care of that, that's not clear code , it's not idea write way.)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -