matlab-optimize-memory
Guides the 7-step MATLAB memory optimization workflow: baseline, profile, identify, optimize, measure, verify, report. Use when asked to reduce MATLAB memory usage, find memory bottlenecks, fix out-of-memory errors, or optimize memory-intensive code.
npx skills add matlab/matlab-agentic-toolkit --skill matlab-optimize-memory --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# MATLAB Memory Optimization Workflow Systematic 7-step workflow for finding and fixing memory bottlenecks in MATLAB code. ## When to Use - User gets out-of-memory errors running MATLAB code - User wants to reduce memory usage of their MATLAB program - User wants to process larger datasets without running out of memory - User asks to profile or measure memory allocations ## When NOT to Use - The bottleneck is execution speed, not memory (use `matlab-optimize-performance`) - The memory issue is in compiled C/MEX code that can't be changed at the M-code level - Memory usage is dominated by I/O buffers (memory-mapped files, database connections) ## The 7-Step Workflow ### Step 1: Establish Memory Baseline Measure current memory usage before making changes. ```matlab m0 = memory; targetFunction(inputs); m1 = memory; deltaBytes = m1.MemUsedMATLAB - m0.MemUsedMATLAB; fprintf('Memory delta: %.2f MB\n', deltaBytes / 1e6); ``` When `memory` errors (Linux/macOS), use `whos` for variable sizes or Java runtime for heap: ```matlab info = whos('result'); fprintf('Variable size: %.2f MB\n', info.bytes / 1e6); ``` ### Step 2: Profile Memory Allocations Find where memory is being allocated. ```matl
- When to Use
- When NOT to Use
- The 7-Step Workflow
- Step 1: Establish Memory Baseline
- Step 2: Profile Memory Allocations
- Step 3: Identify Optimization Opportunities
- Step 4: Implement Optimizations
- Step 5: Measure Optimized Memory
- Step 6: Verify Correctness
- Step 7: Report Results
- Key Rules
- Platform Notes
What does the matlab-optimize-memory skill do?
Guides the 7-step MATLAB memory optimization workflow: baseline, profile, identify, optimize, measure, verify, report. Use when asked to reduce MATLAB memory usage, find memory bottlenecks, fix out-of-memory errors, or optimize memory-intensive code.
How do I install it?
Run `npx skills add matlab/matlab-agentic-toolkit --skill matlab-optimize-memory --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From matlab/matlab-agentic-toolkit, a repository with 868 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
