MOA uses LLMs to automate memory optimization with 42% heap reduction
New framework finds 9 unknown anti-patterns in 100M lines of code
A team of researchers has presented MOA (Memory-Optimization Automation), a framework that leverages large language models to automatically detect and fix memory bloat and churn in massive codebases. MOA operates through three specialized LLM-powered agents: an Analyzer that mines anti-patterns from profiling data, a Checker Generator that synthesizes static analyzers via template-guided refinement, and a Patcher that produces optimization patches using state-machine-driven workflows. This end-to-end pipeline replaces the current manual process where developers must interpret complex tool outputs and craft semantics-preserving fixesβa bottleneck that prevents scaling optimization efforts across millions of lines of production code.
In a rigorous evaluation on OpenHarmony, an open-source operating system with over 100 million lines of C/C++ code, MOA identified 13 distinct memory anti-patterns (nine of which were previously unknown) from just three profiled services. It then scaled detection across seven services, finding over 10,000 specific inefficiencies. The framework autonomously generated 769 patches, which achieved a 92.5% acceptance rate from human experts. These patches delivered an average 42.2% reduction in heap memory usage and a 10.6% reduction in binary size. MOA demonstrates that LLMs can move beyond simple code generation to perform sophisticated, system-level optimization tasks at production scale.
- Identified 13 anti-patterns, including 9 previously unknown memory inefficiencies.
- Generated 769 patches with a 92.5% expert acceptance rate.
- Achieved average 42.2% heap reduction and 10.6% binary size reduction on 7 services.
Why It Matters
Automates tedious memory optimization at scale, saving developers countless hours and reducing cloud costs.