Discussion:
[lwip-users] lwIP memory settings
Seifeddine Jlassi
2009-10-19 09:27:07 UTC
Permalink
Dear lwIP users,

I need confirmation about the lwIP memory use.

The lwIP uses two areas of memory:
- one dedicated to the buffers pbuf and defined by :
PBUF_POOL_SIZE x PBUF_POOL_BUFSIZE
- and one area for the structures (tcp_pcb, udp_pcb) and other
variables which are dynamically allocated, and this area is defined
by: the MEM_SIZE

So, any comment.

With regards
Seif
Simon Goldschmidt
2009-10-19 10:31:51 UTC
Permalink
Post by Seifeddine Jlassi
I need confirmation about the lwIP memory use.
PBUF_POOL_SIZE x PBUF_POOL_BUFSIZE
- and one area for the structures (tcp_pcb, udp_pcb) and other
variables which are dynamically allocated, and this area is defined
by: the MEM_SIZE
That's not all (and partly not correct):
- There are 3 types of pbufs: REF/ROM, RAM and POOL. PBUF_POOL_SIZE * PBUF_POOL_BUFSIZE only refers to type POOL.
- RAM pbufs are allocated in the memory defined by MEM_SIZE (this memory is not used much aside from RAM pbufs) - this is the *heap* and it is allocated as mem_memory.
- REF/ROM pbufs as well as pcbs and some other stuff is allocated from dedicated pools per structure type. The amount of structures is defined by the various MEMP_NUM_ defines. Together, this memory is allocated as memp_memory and it *includes* the pbuf POOL.

However, if you define MEMP_MEM_MALLOC to 1 in your lwipopts.h, *every* piece of dynamically allocated memory will come from the heap (the size of which is defined by MEM_SIZE).

Simon
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
Seifeddine Jlassi
2009-10-19 14:36:29 UTC
Permalink
Thank you for the clarifications.

With regards,
Seif
Post by Simon Goldschmidt
Post by Seifeddine Jlassi
I need confirmation about the lwIP memory use.
PBUF_POOL_SIZE x PBUF_POOL_BUFSIZE
- and one area for the structures (tcp_pcb, udp_pcb) and other
variables which are dynamically allocated, and this area is defined
by: the MEM_SIZE
- There are 3 types of pbufs: REF/ROM, RAM and POOL. PBUF_POOL_SIZE *
PBUF_POOL_BUFSIZE only refers to type POOL.
- RAM pbufs are allocated in the memory defined by MEM_SIZE (this memory is
not used much aside from RAM pbufs) - this is the *heap* and it is allocated
as mem_memory.
- REF/ROM pbufs as well as pcbs and some other stuff is allocated from
dedicated pools per structure type. The amount of structures is defined by
the various MEMP_NUM_ defines. Together, this memory is allocated as
memp_memory and it *includes* the pbuf POOL.
However, if you define MEMP_MEM_MALLOC to 1 in your lwipopts.h, *every*
piece of dynamically allocated memory will come from the heap (the size of
which is defined by MEM_SIZE).
Simon
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
_______________________________________________
lwip-users mailing list
http://lists.nongnu.org/mailman/listinfo/lwip-users
Kieran Mansley
2009-10-21 11:07:02 UTC
Permalink
Post by Simon Goldschmidt
Post by Seifeddine Jlassi
I need confirmation about the lwIP memory use.
PBUF_POOL_SIZE x PBUF_POOL_BUFSIZE
- and one area for the structures (tcp_pcb, udp_pcb) and other
variables which are dynamically allocated, and this area is defined
by: the MEM_SIZE
- There are 3 types of pbufs: REF/ROM, RAM and POOL. PBUF_POOL_SIZE * PBUF_POOL_BUFSIZE only refers to type POOL.
- RAM pbufs are allocated in the memory defined by MEM_SIZE (this memory is not used much aside from RAM pbufs) - this is the *heap* and it is allocated as mem_memory.
- REF/ROM pbufs as well as pcbs and some other stuff is allocated from dedicated pools per structure type. The amount of structures is defined by the various MEMP_NUM_ defines. Together, this memory is allocated as memp_memory and it *includes* the pbuf POOL.
However, if you define MEMP_MEM_MALLOC to 1 in your lwipopts.h, *every* piece of dynamically allocated memory will come from the heap (the size of which is defined by MEM_SIZE).
If there's not already a description like the above on the wiki, could
you add one? That reply was an excellent summary.

Kieran
g***@gmx.de
2009-10-21 14:51:23 UTC
Permalink
Post by Kieran Mansley
If there's not already a description like the above on the wiki, could
you add one? That reply was an excellent summary.
Done :-) Although I had some problems using that wiki... It's not
exactly intuitive to work with...
Grubb, Jared
2009-10-22 00:44:22 UTC
Permalink
Anything I can do to help that?
Jared
Post by g***@gmx.de
Post by Kieran Mansley
If there's not already a description like the above on the wiki, could
you add one? That reply was an excellent summary.
Done :-) Although I had some problems using that wiki... It's not
exactly intuitive to work with...
_______________________________________________
lwip-users mailing list
http://lists.nongnu.org/mailman/listinfo/lwip-users
yueyue papa
2009-10-22 01:44:39 UTC
Permalink
Hi All,

I use lwIP+PPP in GPRS environment. I am still meet the response slow
problem.

The 80% time socket is used in this way

connect --> send --(1xx bytes) ---> receive (1xx bytes)---> disconnect.

What is suitable configureation for my case?

My current configuration is
#####################
#define TCP_QUEUE_OOSEQ 0

/* TCP Maximum segment size. */
#define TCP_MSS 1024

/* TCP sender buffer space (bytes). */
#define TCP_SND_BUF (TCP_MSS*4)

/* TCP sender buffer space (pbufs). This must be at least = 2 *
TCP_SND_BUF/TCP_MSS for things to work. */
#define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)

/* TCP writable space (bytes). This must be less than or equal
to TCP_SND_BUF. It is the amount of space which must be
available in the tcp snd_buf for select to return writable */
#define TCP_SNDLOWAT (TCP_SND_BUF/2)

/* TCP receive window. */
#define TCP_WND (TCP_MSS*4) /*minye.li original is 2048*/
##########################

The slow is cause in send, but the peer has a long delay to get the data. I
am unable to confirm where the long delay comes from.

Lee
Simon Goldschmidt
2009-10-22 06:30:23 UTC
Permalink
Post by Grubb, Jared
Anything I can do to help that?
Jared
Don't know, I tried to add text to the (yet blank) page "Configuring lwIP" and it wouldn't let me saying something about "spam filter"...

Second, I didn't manage to add a new sub-chapter under "Configuring lwIP", however I ended up adding my text in an existing chapter, so it's OK for now, thanks.

Simon
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
Loading...