Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuttX with Networking Flash&RAM increase past 60 days. #6721

Closed
PetervdPerk-NXP opened this issue Jul 27, 2022 · 0 comments · Fixed by #6740
Closed

NuttX with Networking Flash&RAM increase past 60 days. #6721

PetervdPerk-NXP opened this issue Jul 27, 2022 · 0 comments · Fixed by #6740

Comments

@PetervdPerk-NXP
Copy link
Contributor

I've been working to upgrade the NuttX kernel (version ~ 10.1.0+) in PX4 to use the latest apache/incubator-nuttx one.
However in some preliminary testing I've noticed in my use-cases that my flash usage grow ~ 7KB and RAM usage ~ 1KB.

I've been trying to pinpoint what's the cause and found that most of the changes in the past 60 days.
From 6bd2d17 to 0f7da4f
Are causing this increased memory usage in both flash and ram.

For example take the teensy-4.x:netsh config (which hasnt changed in the past 7 months)

Compiling master 0f7da4f

peter@NXL04520:~/nuttx/nuttx$ arm-none-eabi-size nuttx
   text    data     bss     dec     hex filename
 145836     224   32652  178712   2ba18 nuttx

Compiling 6bd2d17

peter@NXL04520:~/nuttx/nuttx$ arm-none-eabi-size nuttx
   text    data     bss     dec     hex filename
 142352     220   32208  174780   2aabc nuttx

Diving deeper it seems that the RAM usage increase mostly comes from the changes in tcp_conn_s (g_tcp_connections).
Master 0f7da4f

peter@NXL04520:~/nuttx/nuttx$ arm-none-eabi-nm --print-size --size-sort ./net/tcp_conn.o
00000000 00000002 b g_last_tcp_port.9059
00000000 00000008 b g_active_tcp_connections
00000000 00000008 b g_free_tcp_connections
00000000 00000010 T tcp_nextconn
00000000 0000002c T tcp_initialize
00000000 00000070 t tcp_listener
00000000 00000080 T tcp_alloc
00000000 00000098 t tcp_selectport
00000000 000000a8 T tcp_free
00000000 000000ac T tcp_bind
00000000 000000b0 T tcp_active
00000000 0000010c T tcp_alloc_accept
00000000 0000010c T tcp_connect
00000000 000007a0 b g_tcp_connections

Compared to 6bd2d17

peter@NXL04520:~/nuttx/nuttx$ arm-none-eabi-nm --print-size --size-sort ./net/tcp_conn.o
00000000 00000002 b g_last_tcp_port.8962
00000000 00000008 b g_active_tcp_connections
00000000 00000008 b g_free_tcp_connections
00000000 00000010 T tcp_nextconn
00000000 0000002c T tcp_initialize
00000000 00000070 t tcp_listener
00000000 00000078 T tcp_alloc
00000000 0000009c T tcp_free
00000000 0000009c t tcp_selectport
00000000 000000ac T tcp_bind
00000000 000000b0 T tcp_active
00000000 00000100 T tcp_alloc_accept
00000000 00000108 T tcp_connect
00000000 000005e0 b g_tcp_connections

Looking at the changes in net/tcp.h
I think the main cause are the changes that introduced new variables in struct tcp_conn_s which gets statically allocated
#6330 #6398

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant