Re: question on select & FD_ISSET
> -----Original Message-----
> From: firstname.lastname@example.org
> Sent: Thu, 15 Mar 2007 11:15:54 -0600
> To: email@example.com
> Subject: Re: question on select & FD_ISSET
> Junior <firstname.lastname@example.org> wrote:
>> True, but it seems to me that if I FD_SET them at the top of the loop
>> without FD_CLR first, I will be expanding the set unnecessarily which
>> would waste memory (eventually run out).
>> Since FD_SET adds the set and FD_CLR clears it from the list, FD_SET
>> without FD_CLR would duplicate fds in the set. Not so?
> It's good that you look out for memory leaks, but in this case there's
> nothing to worry about.
> fd_set is a fixed-size array of bits, indexed by the file descriptor
> number. FD_SET and FD_CLR just modify the fd's bit in that array.
> It's so simple that it can't leak memory. After you've created an
> its size never changes.
> You can see its defition in /usr/include/sys/select.h.
Thanks much for claering this up.
FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
Check it out at http://www.inbox.com/earth