Board index » delphi » IdHTTP Memory Consumption

IdHTTP Memory Consumption

hi!

I posted this question before but did not get any constructive response,
hope i'll have better luck this time. =P

I have the following problem.

When i was downloading a 100Mb file (Trough LAN), i notice that my program
memory consumption (as seen on Task Manager), grows according to the file
size received, I suspect that this might due to the memory stream which i
use to hold the incoming stream.

My Question
1. Is my assumption correct?
2. Can i save the downloaded stream using strm.SaveToFile(filename) when
IdHTTP is downloading?
3. How to prevent this?

Thanks in advance! =)

From,
Hon Yuen, Ng

 

Re:IdHTTP Memory Consumption


"Hon Yuen Ng" <h...@tm.net.my> wrote in message
news:bb8vuq$70332$1@ID-194084.news.dfncis.de...

Quote
> 1. Is my assumption correct?

Yes

Quote
> 2. Can i save the downloaded stream using
> strm.SaveToFile(filename) when IdHTTP is
> downloading?

Use a TFileStream instead of TMemoryStream

Gambit

Re:IdHTTP Memory Consumption


Thanks for your reply. However, my major concern is how to prevent large
memory consumption when downloading large file with IdHTTP. Any comment?

Thanks! =)

From,
Hon Yuen, Ng

"Remy Lebeau (TeamB)" <gambi...@yahoo.com> wrote in message
news:3ed82d0e$1@newsgroups.borland.com...

Quote

> "Hon Yuen Ng" <h...@tm.net.my> wrote in message
> news:bb8vuq$70332$1@ID-194084.news.dfncis.de...

> > 1. Is my assumption correct?

> Yes

> > 2. Can i save the downloaded stream using
> > strm.SaveToFile(filename) when IdHTTP is
> > downloading?

> Use a TFileStream instead of TMemoryStream

> Gambit

Re:IdHTTP Memory Consumption


"Hon Yuen Ng" <h...@tm.net.my> wrote in message
news:bbgr44$982us$1@ID-194084.news.dfncis.de...

Quote
> Thanks for your reply. However, my major concern is
> how to prevent large memory consumption when
> downloading large file with IdHTTP. Any comment?

I already told you how - use a TFileStream instead.  The data will be stored
directly to the harddrive while the file is still downloading, which is what
you asked for, and it will use hardly any memory at all.

Gambit

Other Threads