ワンクリックで
pow10-rule-03-no-dynamic-memory
NASA Power of 10 Rule 3 — No dynamic memory allocation after initialization. Severity: blocker.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
NASA Power of 10 Rule 3 — No dynamic memory allocation after initialization. Severity: blocker.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
NASA Power of 10 Rule 1 — Restrict control flow to simple constructs (no goto, setjmp/longjmp, recursion). Severity: blocker.
NASA Power of 10 Rule 2 — Every loop must have a statically determinable upper bound. Severity: blocker.
NASA Power of 10 Rule 4 — Functions ≤60 lines (one printed page). Severity: high.
NASA Power of 10 Rule 5 — Average ≥2 runtime assertions per function. Severity: high.
NASA Power of 10 Rule 6 — Declare data at smallest possible scope. Severity: medium.
NASA Power of 10 Rule 7 — Check every non-void return value; validate every parameter. Severity: blocker.
| name | pow10-rule-03-no-dynamic-memory |
| description | NASA Power of 10 Rule 3 — No dynamic memory allocation after initialization. Severity: blocker. |
Severity: blocker
After the initialization phase, no heap allocation. All memory comes from fixed-size pools, the stack, or static buffers. Worst-case memory usage must be analyzable at build time.
Heap allocation is nondeterministic: it can fail, fragment, leak, or be used after free. None of these failure modes are statically rule-out-able. Eliminating post-init allocation makes worst-case memory provable.
malloc, new, make([]T, n), [])Allocate at init time. Reuse buffers (object pools, ring buffers, static arrays). Cap input sizes with assertions so worst-case memory is provable. Mark the init/post-init boundary explicitly.
Tag the end of init explicitly so reviewers and tools know where the no-alloc rule kicks in:
int main(void) {
init_pools();
init_drivers();
// pow10:init-end
for (;;) { tick(); }
}
// pow10: allow rule=3 until=YYYY-MM-DD owner=<handle> reason="..."