Skip to content
Ken Bannister edited this page Jul 20, 2017 · 24 revisions

This page shows memory use for gcoap, and for comparison, libcoap. Values are generated using the samr21-xpro board, with the command:

BOARD=samr21-xpro make info-objsize

Also helpful to show sizes in the executable itself:

arm-none-eabi-nm -Sn -t d gcoap.elf

gcoap with Observe extension

Server-side Observe capability is added in PR #6469.

text data bss Notes
2193 208 1182 gcoap.o -- 2 observers and 2 registrations
1 observer and 1 registration: text 2113, data 164
Before addition of Observe: text 1347, data 116
708 0 0 nanocoap.o
2901 208 1182 Total -- 2 observers and 2 registrations
1 observer and 1 registration: text 2821, data 164

Notes

  1. The standard thread stack consumes 1024 B of bss in gcoap.o. We plan to experiment with the stack size to further reduce memory use.
  2. Excludes unneeded nanocoap_sock.c, and coap_build_reply(), coap_handle_req(), coap_reply_simple(), and coap_well_known_core_default_handler() from nanocoap.c. Reduces text section by 785 B.

libcoap

libcoap includes more functionality -- client-side Observe as well as Block, more coverage of options like Uri-Query, and generally more detailed handling.

At the same time, libcoap also uses heap space for dynamic allocations.

text data bss Notes
3351 0 1404 net.o
3216 0 0 resource.o
1373 0 0 uri.o
991 168 0 pdu.o
914 0 0 option.o
498 0 0 block.o
366 0 0 async.o
290 1 0 debug.o
156 0 0 coap_list.o
72 0 0 encode.o
50 0 0 hashkey.o
38 0 0 str.o
12 0 0 subscribe.o
11327 169 1404 Total

Notes

  1. Compiled using the WITH_POSIX flag.