[Top][All Lists]

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

Re: [lwip-users] memp_malloc is NULL

From: Jonathan Larmour
Subject: Re: [lwip-users] memp_malloc is NULL
Date: Tue, 16 Dec 2008 00:48:18 +0000
User-agent: Mozilla Thunderbird 1.0.8-1.1.fc4 (X11/20060501)

Emmanuel Baguia Jr. wrote:
Hi all,

Good day.

The problem last time with my netconn_recv() issue not receiving (blocking), was because the memp_malloc(MEMP_BUF) was not actually allocating space. It is returning NULL value. There is this one forum that is discussing about netconn_recv() blocking. It is somehow referring to process using the same MEMP_BUF and by the time another process is going to use or create another MEMP_BUF, it is not being released by the current process. There is a suggestion to increase the MEMP_NUM_PBUF, but still getting the same NULL value. Am I getting the exact solution here? Or may be miss something that needs to be done?

Do you mean you are running out of netbufs? or pbufs?

It could be you have a memory leak, perhaps due to a bug in your application, a misuse of the lwIP API or a bug in lwIP. Try and increase the number (MEMP_NUM_PBUF for pbufs, MEMP_NUM_NETBUF for netbufs) to a very large amount if you can, and see if you still run out. You do this in lwipopts.h. While you're there, you could usefully enable the lwIP statistics with LWIP_STATS and watch the real usage.

But if you're talking about pbufs, it is possible you are just trying to receive lots of data quicker than you can process it, and so run out of pbufs.... with the netconn and sockets API the data can get buffered indefinitely, even if you have a small TCP receive window (although it's probably worth ensuring you do only have a small TCP window - that will limit how much data a remote peer can send until it's been processed by the stack). If this situation is going to arise frequently and you can't deal with running out of pbufs, then you may have to adjust your port to limit the capacity of mboxes.

But on rereading your description I think you are more likely to be talking about netbufs.

eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["The best things in life aren't things."]------      Opinions==mine

reply via email to

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