optimize-memory-allocation

optimize-memory-allocation is a skill for Claude Code from zystem-io/zymtrace-skills. It costs 411 tokens per session (2,856 once invoked), scanned A, original, Apache-2.0.

A Java Virtual Machine memory-allocation analysis workflow. It examines which parts of a Java program create the most bytes or objects and where garbage collection—the cleanup of unused objects—uses time.

In plain words
What is it for?
Finding hot allocation sites, reading allocation flamegraphs and rankings, and investigating memory-allocation behavior in Java services. It does not apply to non-Java workloads.
Why use it?
It reveals allocation churn that can waste CPU or keep garbage collection busy, even when ordinary CPU profiles do not show the cause clearly.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the zymtrace plugin — 10 skills, 1 agent shipped together

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.

agentmods
npx agentmods add skills/zystem-io/zymtrace-skills/optimize-memory-allocation
Any agent
npx skills add zystem-io/zymtrace-skills --skill optimize-memory-allocation
Clone the repo
git clone --depth 1 https://github.com/zystem-io/zymtrace-skills

Made for: Claude Code.

Or install zymtrace, the plugin that ships this one along with the rest of its 10 skills, 1 agent.

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 optimize-memory-allocation

README.md
[![agentmods](https://agentmods.dev/badge/skills/zystem-io/zymtrace-skills/optimize-memory-allocation.svg)](https://agentmods.dev/skills/zystem-io/zymtrace-skills/optimize-memory-allocation)
Your own site
<a href="https://agentmods.dev/skills/zystem-io/zymtrace-skills/optimize-memory-allocation"><img src="https://agentmods.dev/badge/skills/zystem-io/zymtrace-skills/optimize-memory-allocation.svg" alt="Measured on agentmods" height="20"></a>
Per session 411 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,856 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00411 $0.02856
Opus 5 $0.00205 $0.01428
Sonnet 5 $0.00082 $0.00571
Haiku 4.5 $0.00041 $0.00286

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

Security

Grade A, and why

optimize-memory-allocation 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 6d 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.

zymtrace/skills/optimize-memory-allocation/SKILL.md · 105 lines

How it starts

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

Optimize JVM Memory Allocation

The MCP fetches the data — allocation rankings, allocation flamegraphs, host metrics; you analyze: name the hot allocation sites, identify the pattern, recommend and apply the fix.

Java/JVM only. zymtrace memory-allocation profiling is supported only for the JVM — it reads the allocation profile, stacks weighted by bytes allocated (and object count), not on-CPU time. A non-Java workload has no allocation profile: stay in optimize-cpu-workloads for its on-CPU hotspots. For GPU/device memory use optimize-gpu-workloads. A service that's crashing/OOMKilled rather than churning is a profiler/backend problem — route to troubleshoot-zymtrace-profiler.

The common discipline — data-source policy, pre-flight, rank-first vs. drill-down, scope-to-own-code/ROI, the always-recommend-and-apply-the-fix rule, the output-template skeleton, severity sizing, and security — lives in shared/analysis-conventions.md. Read it. This skill adds the allocation-specific protocol and call-tree rendering on top.

Connection setup lives in configure-zymtrace-mcp; this skill assumes the MCP is connected.

Enable allocation profiling first — it's opt-in

JVM allocation profiling is off by default. Before analyzing, confirm the Java service actually has an allocation profile (try the allocation ranking / flamegraph for it). If it's empty, it isn't enabled yet — turn it on, wait for profiles to arrive, then analyze. Don't fabricate an analysis when there's no allocation data; enable and wait. Full reference: https://docs.zymtrace.com/allocation-profiling.

Prerequisite: the target runs a supported JVM — OpenJDK, Azul Zulu, or Azul Zing.

To enable, ask the user for these inputs, then apply:

  • Target — a CEL expression scoping which workloads to profile (by container / deployment / host / project). Get the scope from the user; see the docs for CEL syntax.
  • Sampling interval — bytes between allocation samples. Default 16mib (production); 512kib for fine-grained at higher overhead.
  • JVMTI backend — use JVMTI as the sampling backend? Default on where supported.

Read the full file on GitHub · 105 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. 6d ago First seen · 105 lines · 411 tokens per session scan A 6e715fbdd3a5

Subscribe to this mod's changes

optimize-memory-allocation is a skill published in the GitHub repository zystem-io/zymtrace-skills (5 stars, last pushed 22d ago), licensed Apache-2.0. It adds 411 tokens to every session and 2,856 once invoked, about $0.0021 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-08-31.

Related

Other skills, from other repositories

nullaway

Guide for resolving NullAway static analysis errors. Best practices for: Passing ObservableSupplier/Supplier Dereferencing potentially @Nullable values Adding @NullMarked to Java code.

chromium/chromium · 43 tokens

wxjava-troubleshooter

排查 WxJava 在配置初始化、access token、签名验签、支付证书、回调通知、序列化、网络请求和多账号隔离方面的问题。适用于用户提供异常、日志、请求响应或“WxJava 为什么不能调用”的场景。.

binarywang/WxJava · 65 tokens

performance-smell-detection

Detect potential code-level performance smells in Java - streams, collections, boxing, regex, object creation. Provides awareness, not absolutes - always measure before optimizing. For JPA/database performance, use jpa-patterns instead.

decebals/claude-code-java · 51 tokens

eclipse-debug

Debug Java applications in Eclipse — set breakpoints, launch in debug mode, step through code, inspect stack traces, evaluate expressions, and hot-swap code changes.

gradusnikov/eclipse-chatgpt-plugin · 37 tokens

126-java-exception-handling

Use when you need to apply Java exception handling best practices — including using specific exception types, managing resources with try-with-resources, securing exception messages, preserving error context via exception chaining, validating inputs early with fail-fast principles, handling thread interruption…

jabrena/plinth · 144 tokens

eclipse-analyze

Analyze Java code using Eclipse JDT tools — type hierarchy, find references, call hierarchy, compilation errors, quick fixes, and import suggestions. Use this to understand code structure before making changes.

gradusnikov/eclipse-chatgpt-plugin · 43 tokens