[Top][All Lists]

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

AW: [lwip-devel] Memory leak for timeouts

From: Goldschmidt Simon
Subject: AW: [lwip-devel] Memory leak for timeouts
Date: Tue, 6 Nov 2007 10:33:49 +0100

> As a consequence, we have many threads created. By doing some tests,
we've found a memory leak around timeouts. 
> Indeed, sys_timeouts should provide memory local to each thread. On
L4, we use TLS (thread local
> storage) : in each thread, if no TLS corresponding to sys_timeouts has
been referenced, a malloc is done and is 
> then referenced into TLS.
> But, this little chunk of memory is newer freed.

> Today, we decided to fix this by creating a sys_thread_exit function
which free the sys_timeout structure
> referenced into TLS. Is there another way we didn't find in lwip ?
> Should I propose a patch (sys.h) ? a bug ?

This is indeed a problem if you create and destroy threads at runtime.
However, the lwIP sys layer is designed to never end a running thread
(as most embedded systems do), so this is not a problem for most users.

As you malloc the struct yourself (in your port) you have to provide the
thread-exit function yourself (or in your port), which is not a thing
every port (or even the core) needs.


reply via email to

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