# marmot size (/docs/commands/size)

<!-- Generated by scripts/gen.mjs from `marmot size --help` and scripts/commands.mjs. Do not edit by hand. -->

Break an executable down by section, by package and by function, and show what calls a function (-why). Function names and sizes come from marmot's pc table, or from the symbol table for other binaries.

```text title="Usage"
marmot size BINARY [flags]
```

## Examples [#examples]

```sh
marmot size ./app
marmot size -pkg fmt ./app
marmot size -why fmt.Sprintf ./app
```

`marmot size app` lists the sections of the executable, the code of each package and the
largest functions. `-pkg fmt` lists one package's functions; `-why fmt.Sprintf` prints a chain
of direct calls from `main` to the function, which says why it is linked in. It also reads
binaries built by other compilers, through their symbol table.

`-json` writes one `size` object with `sections`, `packages` and `functions`; with `-why` it
has `why` with `chain`.

## Flags [#flags]

Flags take one dash or two: `-release` and `--release` are the same.

| Flag | Meaning |
| --- | --- |
| `-color string` | color in human output: auto, always or never (NO_COLOR turns auto off) (default "auto") |
| `-json` | machine readable output: JSON Lines on stderr (also $MARMOT_OUTPUT=json, and the default under coding agents) |
| `-n string` | how many packages and functions to list (default "15") |
| `-pkg string` | list the functions of this package only |
| `-why string` | show a chain of direct calls from main to this function |

## Full help [#full-help]

```text title="marmot size --help"
Break an executable down by section, by package and by function, and show what calls a function (-why). Function names and sizes come from marmot's pc table, or from the symbol table for other binaries.

Usage:
  marmot size BINARY [flags]

Examples:
marmot size ./app
marmot size -pkg fmt ./app
marmot size -why fmt.Sprintf ./app

Flags:
      --color string   color in human output: auto, always or never (NO_COLOR turns auto off) (default "auto")
  -h, --help           help for size
      --json           machine readable output: JSON Lines on stderr (also $MARMOT_OUTPUT=json, and the default under coding agents)
      --n string       how many packages and functions to list (default "15")
      --pkg string     list the functions of this package only
      --why string     show a chain of direct calls from main to this function
```