[En-Nut-Discussion] TCP uses to much memory with zero window?

Bernd Walter enut at cicely.de
Thu Jun 11 13:57:00 CEST 2009


On Wed, Jun 10, 2009 at 04:09:33PM +0200, Harald Kipp wrote:
> Bernd Walter wrote:
> 
> > Updating worked after a few minor compile time problems.
> > System is runnning with 4.8.2.
> > I have a bit more free RAM after the update :-)
> 
> We changed the direction. Unlike with previous upgrades we hope to be
> able to reduce memory usage in newer versions. ;-)

Nice idea ;-)
For me the most missing feature in respect to save memory however would
be a listen queue.
Needing multiple threads for a service consumes a major part of memory
in my applications.

> > But the network problem is still there.
> > I started with about 26k free and it went below 3k and finally the
> > system hang.
> 
> I'm not sure that this is network related. After upgrading, you are now
> able to dump heap usage.
> 
> Add
> 
> HWDEF+=-DNUTDEBUG_HEAP
> 
> to UserConf.mk (build and app tree) and rebuild everything. At specific
> locations within your application call
> 
> NutHeapDump(<file-pointer>);

I like that feature.

> replacing <file-pointer> with your console stream, probably stdout.
> You'll get a list of all allocated fragments, which will help to locate
> the memory hole.

It agrees with my assumption.
After some time it fills up with many small netbuf allocations:
[...]
0x20b420(60) netbuf.c:146
0x20b3e4(40) netbuf.c:185
0x20b394(60) netbuf.c:146
0x20b358(40) netbuf.c:185
0x20b308(60) netbuf.c:146
0x20b2cc(40) netbuf.c:185
0x20b27c(60) netbuf.c:146
0x20b240(40) netbuf.c:185
0x20b1f0(60) netbuf.c:146
0x20b1b4(40) netbuf.c:185
0x20b164(60) netbuf.c:146
0x20b128(40) netbuf.c:185
0x20b0d8(60) netbuf.c:146
0x20b09c(40) netbuf.c:185
0x20b04c(60) netbuf.c:146
0x20b010(40) netbuf.c:185
0x20afc0(60) netbuf.c:146
0x20af84(40) netbuf.c:185
0x20af34(60) netbuf.c:146
0x20aef8(40) netbuf.c:185
0x20aea8(60) netbuf.c:146
0x20ae6c(40) netbuf.c:185
0x20ae1c(60) netbuf.c:146
0x20ade0(40) netbuf.c:185
0x20ad90(60) netbuf.c:146
0x20ad54(40) netbuf.c:185
0x20ad04(60) netbuf.c:146
0x20acc8(40) netbuf.c:185
0x20ac78(60) netbuf.c:146
0x20a7c4(40) netbuf.c:185
[...]

I can send you complete traces, if you want.
I have no local modifications in netbuf.c, so linenumbers should match
with yours.

-- 
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.



More information about the En-Nut-Discussion mailing list