Back to Tinygo

Size Report for {{.pkgName}}

builder/size-report.html

0.41.11.6 KB
Original Source

Size Report for {{.pkgName}}

How much space is used by Go packages, C libraries, and other bits to set up the program environment.

  • Code is the actual program code (machine code instructions).
  • Read-only data are read-only global variables. On most microcontrollers, these are stored in flash and do not take up any RAM.
  • Data are writable global variables with a non-zero initializer. On microcontrollers, they are copied from flash to RAM on reset.
  • BSS are writable global variables that are zero initialized. They do not take up any space in the binary, but do take up RAM. On microcontrollers, this area is zeroed on reset.

The binary size consists of code, read-only data, and data. On microcontrollers, this is exactly the size of the firmware image. On other systems, there is some extra overhead: binary metadata (headers of the ELF/MachO/COFF file), debug information, exception tables, symbol names, etc. Using -no-debug strips most of those.

Program breakdown

You can click on the rows below to see which files contribute to the binary size.

PackageCodeRead-only dataDataBSSBinary size
{{range $i, $pkg := .sizes}}{{.Name}}{{.Size.Code}}{{.Size.ROData}}{{.Size.Data}}{{.Size.BSS}}
{{range $filename, $sizes := .Size.Sub}}{{if eq $filename ""}} (unknown file) {{else}} {{$filename}} {{end}}{{$sizes.Code}}{{$sizes.ROData}}{{$sizes.Data}}{{$sizes.BSS}}
{{end}} {{end}}Total{{.sizeTotal.code}}{{.sizeTotal.rodata}}{{.sizeTotal.data}}{{.sizeTotal.bss}}