Fitting Stecho into an iMessage extension: memory, seconds, bytes

Stecho does its work inside Messages, in a process with a memory limit Apple does not publish. What the first engine needed, what the limit turned out to be on two phones, and how many bytes a second of voice takes.

Stecho does its work inside an iMessage extension: a process Messages starts for the app, with less memory than an app gets and a limit Apple doesn’t publish. Four numbers decide whether that works.

A gigabyte, then 50 MB

The first engine kept its whole trellis search in memory: 1.16 GB at 1024 × 768. The system killed it at 1536 × 1152 on the iPhone 12 mini and at 2048 × 1536 on the 15 Pro. The rewrite keeps checkpoints and writes the same file, number for number: 36–50 MB at 2048 × 1536 and 73–105 MB at 3024 × 2268, on five camera photos on the 12 mini.

The limit

Read from inside the extension during real sends, footprint plus available memory came to 700 MB on the iPhone 12 mini (iOS 26.7.2) and 800 MB on the 15 Pro (iOS 27.2), every time. A send peaked at 142–146, 160 and 209 MB with 2048, 3024 and 4032 px photos, within 4 MB on both phones. On these two, memory doesn’t limit the photo size; a phone with less RAM may well differ.

  • First engine, 1024 × 768, in the app 1160 MB killed at larger sizes
  • Send, 2048 px 142–146 MB
  • Send, 3024 px 160 MB
  • Send, 4032 px 209 MB

Peak memory of one send inside the extension, against the limit read on each phone. The first engine’s figure is from the app process at 1024 × 768, before the rewrite.

Seconds

At 2048 / 3024 / 4032 px:

  • hiding a short text, inside the extension: 2.7 / 5.3 / 9.4 s on the 15 Pro, 4.5 / 9 / 17 s on the 12 mini;
  • a full voice note with a password, 12 mini, in the app: 3.3–5.8 / 7.2–12.7 / 11.7–20.2 s;
  • reading with the right password: 1.0–1.4 / 1.6–2.5 / 2.0–3.6 s.
  • Hide a text, 2048 px 2.7–4.5 s
  • Hide a text, 3024 px 5.3–9.0 s
  • Hide a text, 4032 px 9.4–17.0 s
  • Voice note with a password, 2048 px 3.3–5.8 s
  • Voice note with a password, 3024 px 7.2–12.7 s
  • Voice note with a password, 4032 px 11.7–20.2 s
  • Read with the right password, 2048 px 1.0–1.4 s
  • Read with the right password, 3024 px 1.6–2.5 s
  • Read with the right password, 4032 px 2.0–3.6 s

The same numbers as bars; the notch is the low end of each range. A text row runs from the 15 Pro to the 12 mini; the voice and reading rows are the 12 mini alone, five photos each.

A wrong password costs as much as the right one, so Stecho tries only the password saved for the chat and offers the others in a menu.

Bytes per second of voice

With Opus at the app’s settings, on synthetic voices: 1473 bytes per second at 12 kbps (1512 without pauses), 966 at 8 kbps, 755 at 6. Half the bitrate is twice the seconds, but at 6 and 8 kbps Opus switches to narrowband, the range of a telephone line. Skipping silence, 60 ms frames and a one-byte frame length would save 26.7 % at 12 kbps; two of them change the format, so they wait.

  • 12 kbps 1473 B/s
  • 8 kbps 966 B/s narrowband
  • 6 kbps 755 B/s narrowband

Bytes per second of voice at the three bitrates. Half the bitrate is twice the seconds, and below 12 kbps the sound narrows to a telephone line.

What it adds up to

With the default setting, on five of my photos at 3024 px, one photo held 45–102 KB with Pro: 28–64 seconds of voice. Free holds half. Not measured yet: older phones, a voice note inside the extension, real speech.

Journal