Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Oct : Re: TidTCPServer Memory Leak
| Subject: | Re: TidTCPServer Memory Leak |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Fri, 13 Oct 2006 09:48:05 |
"Bogdan Mitic" <bj@infomitic.com> wrote in message
news:452fc045$1@newsgroups.borland.com...
> Socket,Write(lSize);.
> Socket,Write(lStream, lSize);.
<snip>
> lSize := Socket.readInt64;.
> Socket.ReadStream(aFileStream, lSize);
> aFileStream.Free;
If you set the LargeStream property to True on the connections, you won't
have to call Write(Int64) or ReadInt64() anymore.
> The data gets transfered perfectly, however, each time the client does
> this the memory of the Server process increases and even if the client
> disconnects the server the memory is never released.
You have not shown enough code to diagnose that.
> I believe that I mapped the memory allocation to
Socket.ReadStream(aFileStream, lSize) call
How did you do that exactly?
Do note that all of Indy's reading methods will cache inbound data into a
membory buffer. So if you are sending more data following the stream, you
could just be seeing the extra data being cached for later reads. There is
nothing else in ReadStream() that allocates memory otherwise.
> but I am not sure how to correct this. Within minutes of client sending
data.
> the server process can reach 400MB memory usage.
What else is your server doing? It is very unlikely that ReadStream() is
the problem.
Gambit
none