How to analyze static memory usage of rust binary?


I am compiling a firmware for an embedded system in which static memory is limited, and it seems like I used too much static memory and now the linker outputs the following error (truncated):

note: ld: binary section `.bss' will not fit in region `dram_seg'
          ld: region `dram_seg' overflowed by 32484 bytes
          collect2: error: ld returned 1 exit status

Are there any tools for analyzing the static memory usage of the binary, maybe showing which static variables use most of the memory? Something like cargo bloat, but for static variables?


You might want to look at symbols in the object files you're linking, like it was done here for already linked library.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.