axiom-objc-block-retain-cycles

axiom-objc-block-retain-cycles is a skill for Claude Code, Codex from ComeOnOliver/skillshub. It costs 45 tokens per session (5,517 once invoked), scanned A, original, MIT.

A guide to finding memory leaks and crashes caused by Objective‑C blocks, which are reusable pieces of code that can keep objects alive.

In plain words
What is it for?
Use it to investigate growing memory use, objects that never deallocate, or callbacks that access released objects.
Why use it?
It explains retain cycles and weak references so callbacks do not keep view controllers or other objects in memory after they should be released.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to investigate growing memory use, objects that never deallocate, or callbacks that access released objects.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/comeonoliver/skillshub/axiom-objc-block-retain-cycles
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ComeOnOliver/skillshub --skill axiom-objc-block-retain-cycles
Clone the repo
git clone --depth 1 https://github.com/ComeOnOliver/skillshub

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for axiom-objc-block-retain-cycles

README.md
[![agentmods](https://agentmods.dev/badge/skills/comeonoliver/skillshub/axiom-objc-block-retain-cycles/github.svg)](https://agentmods.dev/skills/comeonoliver/skillshub/axiom-objc-block-retain-cycles)
Your own site
<a href="https://agentmods.dev/skills/comeonoliver/skillshub/axiom-objc-block-retain-cycles"><img src="https://agentmods.dev/badge/skills/comeonoliver/skillshub/axiom-objc-block-retain-cycles/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for axiom-objc-block-retain-cycles

Your own site · 80×15
<a href="https://agentmods.dev/skills/comeonoliver/skillshub/axiom-objc-block-retain-cycles"><img src="https://agentmods.dev/badge/skills/comeonoliver/skillshub/axiom-objc-block-retain-cycles.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,517 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00045 $0.05517
Opus 5 $0.00023 $0.02759
Sonnet 5 $0.00009 $0.01103
Haiku 4.5 $0.00005 $0.00552

Measured 9d ago against content hash b163aeca55ab, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

axiom-objc-block-retain-cycles scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/CharlesWiltgen/Axiom/axiom-objc-block-retain-cycles/SKILL.md · 603 lines

How it starts

The opening of the file, as written. The whole thing — 603 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Objective-C Block Retain Cycles

Overview

Block retain cycles are the #1 cause of Objective-C memory leaks. When a block captures self and is stored on that same object (directly or indirectly through an operation/request), you create a circular reference: self → block → self. Core principle 90% of block memory leaks stem from missing or incorrectly applied weak-strong patterns, not genuine Apple framework bugs.

Red Flags — Suspect Block Retain Cycle

If you see ANY of these, suspect a block retain cycle, not something else:

  • Memory grows steadily over time during normal app use
  • UIViewController instances not deallocating (verified in Instruments)
  • Crash: "Sending message to deallocated instance" from network/async callback
  • Network requests or animations prevent view controller from closing
  • Weak reference becomes nil unexpectedly in a block
  • NSLog, NSAssert, or string formatting hiding self references
  • Completion handler fires after the view controller "should be gone"
  • FORBIDDEN Rationalizing as "It's probably normal memory usage"
    • Memory leaks are never "normal"
    • Apps should return to baseline memory after user dismisses a screen
    • Do not rationalize this as "good enough" or "monitor it later"

Critical distinction Block retain cycles accumulate silently. A single cycle might be 100KB, but after 50 screens viewed, you have 5MB of dead memory. MANDATORY: Test on real device (oldest supported model) after fixes, not just simulator.

Mandatory First Steps

ALWAYS run these FIRST (before changing code):

// 1. Identify the leak with Allocations instrument
// In Xcode: Xcode > Open Developer Tool > Instruments
// Choose Allocations template
// Perform an action (open/close a screen with the suspected block)
// Check if memory doesn't return to baseline
// Record: "Memory baseline: X MB, after action: Y MB, still allocated: Z objects"

// 2. Use Memory Debugger to trace the cycle
// Run app, pause at suspected code location
// Debug > Debug Memory Graph
// Search for the view controller that should be deallocated
// Right-click > Show memory graph
// Look for arrows pointing back to self (the cycle)
// Record: "ViewController retained by: [operation/block/property]"

// 3. Check if block is assigned to self or self's properties
// Search for: setBlock:, completion:, handler:, callback:
// Check: Is the block stored in self.property?
// Check: Is the block passed to something that retains it (network operation)?
// Record: "Block assigned to: [property or operation]"

// 4. Search for self references in the block
// Look for: [self method], self.property, self-> access
// Look for HIDDEN self references:
//   - NSLog(@"Value: %@", self.property)
//   - NSAssert(self.isValid, @"message")
//   - Format strings: @"Name: %@", self.name
// Record: "self references found in block: [list]"

// Example output:
// Memory not returning to baseline ✓
// ViewController retained by: AFHTTPRequestOperation
// Operation retains: successBlock
// Block references self: [self updateUI], NSLog with self.property
// → DIAGNOSIS: Block retain cycle confirmed

Read the full file on GitHub · 603 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 603 lines · 45 tokens per session scan A b163aeca55ab

Subscribe to this mod's changes

axiom-objc-block-retain-cycles is a skill published in the GitHub repository ComeOnOliver/skillshub (63 stars, last pushed 2mo ago), licensed MIT. It adds 45 tokens to every session and 5,517 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.