[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Problem with memory management
From: |
FreeRTOS Info |
Subject: |
Re: [lwip-users] Problem with memory management |
Date: |
Fri, 03 Feb 2012 10:15:32 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 |
On 03/02/2012 10:00, Walter Saegesser wrote:
> I encounter a severe problem with the memory manager (mem.c,
> MEM_USE_POOLS not set, LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT not set).
>
> My buffer is approx 40kB. An SSL connection to a server on the internet
> does a big amount of allocations/deallocations (mostly small blocks).
> For receiving data from the server I need 1kB blocks.
>
> It all works fine until all of a sudden the manager is no longer able to
> get a 1kB block and the ‘err’ counter of the mem-stats is counted up
> (every 100ms for about 15s until the system is reset by the watchdog).
>
>
>
> In the debugger I have a real-time monitoring of the used ram
> (lwip_stats.mem.used). The value goes up and down, as expected,
> definitively no accumulation. The high-water-mark is at least 10kB below
> the heap size.
>
> The system is multitasking. The task trying to get the 1kB block sleeps
> for a while if it fails, thus enabling other tasks to run and possibly
> free memory. However, the error is not recoverable and the system crashes.
>
> If the systems runs into this situation (one task trying in vain to get
> a 1kB block), you can see the ‘used’ value go down to about 22kB, i.e.
> almost 18kB are free.
>
>
>
> The problem arises always at almost the same amount of data received
> from the server, so I think it’s a systematic problem and not just
> accidental.
>
> Could this be a bug or what else could be wrong?
If MEM_USE_POOLS is not set could this simply be memory fragmentation?
Regards,
Richard.
+ http://www.FreeRTOS.org
Designed for Microcontrollers.
More than 7000 downloads per month.