lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] tcp_close memory leak


From: Tim Newsham
Subject: Re: [lwip-users] tcp_close memory leak
Date: Mon, 19 Jul 2004 22:55:43 -1000 (HST)

> > If you call tcp_close(tcp_new()) you will create new PCB's but
> > never destroy them.
>
> Why would you call like that?

Not all lwIP apps are tightly integrated with the stack.  Consider
for example if you provide an API to other apps and you have
seperate bind() and connect() calls.  Before the bind() is complete,
a tcb needs to be created.  If the application does a close()
before a connect() then you will tcp_close() the tcb while it is
in the closed state.

> > The tcp_close function does not free
> > the pcb memory if the pcb is in the closed state.
>
> Nor if it's in the SYN_RCVD, ESTABLISHED, or CLOSE_WAIT states.

In these states it moves towards a closed state.  I didn't
continue reading the code, but I was under the impression that
the pcb would be closed in the future after the pcb reaches the
closed state.

Is this not the case?  If not, what does one have
to do to ensure that a pcb is destroyed properly?
Do I have to keep around a pointer to the pcb after tcp_close()
returns ERR_OK until some later event?

> I'm not sure what's wrong with the current behaviour, or what behaviour
> you expect.

I expect that I can get rid of a pcb after creating it even if
I never use the pcb.  What is the proper way to do this?

> Kieran

Tim N.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]