Send lwip-users mailing list submissions to
address@hidden
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.nongnu.org/mailman/listinfo/lwip-users
or, via email, send a message with subject or body 'help' to
address@hidden
You can reach the person managing the list at
address@hidden
When replying, please edit your Subject line so it is more specific
than "Re: Contents of lwip-users digest..."
Today's Topics:
1. lwIP malloc fail (Navcon - Pedro Paulo Santos)
----------------------------------------------------------------------
Message: 1
Date: Tue, 6 Apr 2010 12:38:19 -0300
From: "Navcon - Pedro Paulo Santos" <address@hidden>
Subject: [lwip-users] lwIP malloc fail
To: <address@hidden>
Message-ID: <address@hidden>
Content-Type: text/plain; charset="iso-8859-1"
Hi all!
I'm having a problem in trying to make a system with lwIP that sends a large
file with TCP from an external serial Flash memory.
I use the following logic: read certain amont of data from the external memory,
send over TCP with tcp_write (), read more data, send again, and there goes on.
I made a function to handle lack of memory because of Nagle's algoritm (because
I have little memory and can't prepare a large TCP message), and use tcp_output
() to force the send of the amont of data. The problem is that after some
transfers (no more than 15 tcp transfers) the program doesn't find memory to
alloc in the following lines of tcp_enqueue () function:
/* Allocate memory for tcp_seg, and fill in fields. */
seg = memp_malloc(MEMP_TCP_SEG);
if (seg == NULL) {
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: could not allocate memory for
tcp_seg\n"));
goto memerr;
}
In my thinking, the tcp_output () function should free memory for the further transfers
so that I can transfer any amont of data if I make a lot of consecutive "small"
transfers.
It occurs even if I send really small messages, with 20 bytes, for example. I
already tried to edit lwipopts.h raising TCP_SND_BUF, TCP_WND, TCP_MSS,
PBUF_POOL_SIZE, MEM_SIZE... but I got no good results.
Do I have to free memory, myself, in any part of the lwIP implementation?
(I already free the pbuf that my recv function returns as callback after the
read)
Anyone have a suggestion of what could be the problem?
Informations: I'm using an ARM microcontroller with 64kB SRAM and 256kB flash.
I already made an HTTP server into it, but it spends very little memory. My
external serial (SPI) flash memory have 128MB.
Thanks to all!
Pedro Paulo.
__________ Informação do ESET NOD32 Antivirus, versão da vacina 4628 (20091122)
__________
A mensagem foi verificada pelo ESET NOD32 Antivirus.
http://www.eset.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.gnu.org/pipermail/lwip-users/attachments/20100406/45825ecd/attachment.html
------------------------------
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users
End of lwip-users Digest, Vol 80, Issue 4
*****************************************