[En-Nut-Discussion] Heap, Multi-Thread HTTP application, and memory Loss

Ole Reinhardt ole.reinhardt at embedded-it.de
Thu Oct 25 16:11:13 CEST 2007

> The problem is the loss of free memory.
> Using *NutDumpHeap(stdout)*, I see the number of free blocks in the heap
> increases after the first call to the page, and then, after each call, the
> large free block at the end shrinks.

Have you tried NutHeapAvail()? I never tried NutDumpHeap, but for me it
sounds as it does not realy show the available heap but the lagest free
block. AFAIK the heap may be fragmented and handled as a linked list of
free blocks. So it might be possible that the largest free lock shinks
in size over the time even in sum there is the same space available as

> Isn't a thread, by definition, an interrupt routine?  Even the threads *
> emacrx* and *tcpsm* use *NutHeapAlloc()* and *NutHeapFree()*.

No, it is not. Neither in preemptive nor ein cooperative (like NutOS
does it) multitasking an interrupt routine should be longer than a few


Ole Reinhardt

|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |

More information about the En-Nut-Discussion mailing list