lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Custom placement of memory pool


From: Giuseppe Modugno
Subject: Re: [lwip-users] Custom placement of memory pool
Date: Fri, 9 Nov 2018 11:38:07 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0

Il 09/11/2018 04:05, uaz ha scritto:
Hi all,

I'm currently running lwip v2.0.3 on LPC4357 platform.
I have some issue with pbuf mem_alloc(), which I believe is fragmentation
issue because after several packet transfers, I'm unable to allocate pbuf
anymore.

I don't know if it is the same problem I faced some months ago with the MCU LPC1769.

I found a behaviour similar to the one you are describing. After some HTTP requests (received and answered correctly), no more HTTP requests are possible. Consider that the problem appeared only with HTTP requests that needed custom file (as internal lwip http server nomenclature).

The solution I found is defining MEMP_MEM_MALLOC to *0/zero* (it was set to 1/one). When set, this macro enables mem_malloc/mem_free for pools management (so dynamic management instead of static management). In my case, mem_malloc/mem_free are effectively malloc/free of newlib C standard library (because I defined MEM_LIBC_MALLOC to 1).

Here[1] you read the definition of MEMP_MEM_MALLOC macro:

MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator. Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution speed (heap alloc can be much slower than pool alloc) and usage from interrupts (especially if your netif driver allocates PBUF_POOL pbufs for received frames from interrupt)! ATTENTION: Currently, this uses the heap for ALL pools (also for private pools, not only for internal pools defined inmemp_std.h <http://www.nongnu.org/lwip/2_0_x/memp__std_8h.html>)!
I think the NXP Ethernet driver implementation isn't compatible with MEMP_MEM_MALLOC. Anyway I'm not sure, because the problem happens only for "custom file" http requests and not for every request.

[1] http://www.nongnu.org/lwip/2_0_x/group__lwip__opts__mem.html#gae93af697d27bbcefa6a28052d90f2f38


Right now I'm switching to custom memory pool approach, but I'm consuming
more SRAM than available, thus the project is not compiling.

Is there any way to manually place memory pool to a certain address?

Thanks,
UAZ



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users



reply via email to

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