[PD] calling free-method on pd quit (was Re: Problem with tcpserver from iemnet)

IOhannes m zmölnig zmoelnig at iem.at
Thu Feb 16 17:13:24 CET 2012

On 02/15/12 23:13, Roman Haefeli wrote:
> I have that as well, but it seems it is not specific to iemnet's
> classes. I experience that with many net classes in Pd and also - IIRC -
> with other programming languages that provide ways to open a listening

the problem is, that the socket does get not closed properly by Pd.
this is due to the "feature" of Pd, that it doesn't call the free-method 
(destructor) of an object, is you just "quit" Pd.
(if you explicitely delete the object, the free-method is called just 
fine; but not if you just do a [; pd quit(; see also my bug-report/patch 
about this on sf ( which seems to be down currently)

if the socket does not get closed properly, the OS will free it after 
some timeout.

> socket. On my box it is a matter of seconds until the bind address is
> freed. On an earlier Debian installation, it was often a matter of
> minutes (for instance, when the netpd server crashed), which was more
> annoying. I haven't figured out a way to avoid this.

the only way to avoid this, is to properly close the socket on exit.

depending on your OS, you can modify the timeout, in order to shorten 
your re-launch times.

on linux, try something like
# echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle


More information about the Pd-list mailing list