Junior <[EMAIL PROTECTED]> 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 fd_set, its size never changes. You can see its defition in /usr/include/sys/select.h. -- Sebastian Kuzminsky The universal acid of the true knowledge had burned away a world of words, and exposed a universe of things. Things we could use. -- Ken MacLeod -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

