[EMAIL PROTECTED] wrote: > Hi Clive, > > > Dear All, > > > > In sockets.c, there are two semaphores that are created on > > first invocation, that are never destroyed - these are > > socksem and selectsem, created in alloc_socket() and > > event_callback() respectively. If I want to completely free > > all heap memory taken by the stack, these sems need to be > > destroyed as semaphore creation allocates memory on my OS. > > > > The question is, where is it safe for them to be destroyed? > > My hunch is that it would be OK at the end of lwip_close(), > > immediately before the return statement. > > > > Does anyone have any views on this? > > This seems to be a general problem of the stack. Because in embedded > systems, you normally don't need to shut down anything but just turn of > power, this is not a problem for most lwIP-users. If you wanted to > safely shut down the complete stack, you would need shutdown-functions > corresponding to all the *_init() functions... But who would need that > ;-)
Well, I have a management thread, a purpose of which is to kill errant tasks. Sure, I can destroy the task that LwIP occupies, but leaving a memory leak each time... For my application, a reboot isn't really very polite. Kind regards, Clive Wilson _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
