StoreRules

Rules · Support 16 KB page sizes · Optimize custom memory allocators

1. Avoid hard-coded byte thresholds for freeing memory

In plain words

If your app uses a custom memory allocator, don't use hard-coded byte constants for page-release thresholds; scale them at runtime from the actual page size via sysconf(_SC_PAGESIZE).

  • Fixed byte limits for releasing memory with madvise(MADV_DONTNEED), such as releasing only below 8 KB of active objects, can fail on 16 KB systems.
  • On 16 KB systems, a single 16-byte live object pins a whole 16 KB page, so the threshold is never met and unused memory isn't returned to the kernel.
  • The instruction is to never use hard-coded byte constants for page-release heuristics.
  • This applies only to custom allocators; the parent note says apps using the standard Android allocator (scudo) can skip it.

Summary written by StoreRules and checked against the official text.

From the official text

Many allocators use fixed byte limits to decide when to release memory back to the OS using madvise(MADVDONTNEED) (for example, only release memory if active objects take up less than 8 KB ). On a 16 KB system, even a single 16-byte live object pins an entire 16 KB page (which is greater than 8 KB). As a result, the …

Read the full official text ↗ Open in the StoreRules library Ask whether your app complies

Change history

No substantive change since StoreRules began tracking it.

First seen: 2026-10-16

Developers' cases about this clause

No cases yet.

Share your case