lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] How to estimate heap memory usage (TCP case)


From: narke
Subject: [lwip-devel] How to estimate heap memory usage (TCP case)
Date: Mon, 12 Mar 2012 12:42:44 +0800

Hi,

I got following run time error:

    166945| tcp_write(pcb=10001db4, data=20082c18, len=1256, apiflags=1)
    166950| mem_malloc: could not allocate 1328 bytes
    166950| tcp_write : could not allocate memory for pbuf copy size 1256


My configuration is NO_SYS=1 mode, and I was sending data via
tcp_write.  The COPY_ON_WRITE flag was
enabled by default.  And, I also disabled the nagle algorithm.  Before
each time of calling tcp_write, I always call
snd_buf(), and after each time of tcp_write(), I called tcp_output()
immediately.

My TCP_MSS is 1388 and TCP_SND_BUF is 4 * TCP_MSS.

I'v already allocated 7K bytes for the heap.  (MEM_SIZE), but it seems
I still run out of memory.

So, my question is, according to my use pattern.  Can I deduce how
much heap memory I will need?
In generate, in the case of SND_BUF = 3 * MSS, to prevent tcp_write()
from returning error, what the
peak memory consuming of tcp_write() function?


Thanks in advance.


-- 
Life is the only flaw in an otherwise perfect nonexistence
    -- Schopenhauer

narke
public key at http://subkeys.pgp.net:11371 (address@hidden)



reply via email to

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