- A large share of serious vulnerabilities in big C and C++ codebases have historically stemmed from memory safety errors.
- Government agencies and major vendors now openly encourage memory-safe languages and published migration roadmaps.
- Rewrites of whole systems are rare and risky. Most successful efforts are incremental, starting with new code and high-risk components.
- Rust is the most visible option, but managed languages, safer C++ practices, and hardware mitigations all play a role.
- Interoperability, tooling, and training determine success far more than language enthusiasm.
Few ideas in software engineering have traveled from niche conviction to official policy as quickly as memory safety. What began as a long-running argument among systems programmers has become a topic in government guidance, vendor roadmaps, and procurement conversations. The quiet question behind it is simple: how much of the world’s critical infrastructure should still depend on languages that let a single off-by-one mistake become a security breach?
01What memory safety actually means
Languages like C and C++ give programmers direct control over memory. That power enables remarkable performance and made them the foundation of operating systems, browsers, databases, and embedded devices. It also means the programmer is responsible for never reading or writing outside the bounds of an allocation, never using memory after it is freed, and never freeing it twice.
When those rules are broken, the program’s behavior becomes undefined. In practice, that can mean crashes, corrupted data, or, in the worst cases, an attacker steering execution to run their own code. Common categories include buffer overflows, use-after-free errors, and data races on shared memory.
Memory-safe languages prevent whole classes of these errors, either by checking at runtime, as many garbage-collected languages do, or by enforcing rules at compile time, as Rust does through its ownership and borrowing system. The result is that a mistake which would silently corrupt memory in one language becomes a compile error or a controlled failure in another.
02Why the topic became official
Large engineering organizations have repeatedly reported, in public analyses of their own vulnerability data, that memory safety bugs account for a substantial portion of their most severe security issues. While exact percentages vary by project and period, the pattern has been consistent enough to change thinking.
Government agencies took notice. Cybersecurity authorities in several countries have published guidance encouraging developers and vendors to adopt memory-safe languages and to publish roadmaps describing how they will reduce memory safety risk in their products. The framing is part of a broader secure-by-design movement that asks manufacturers, rather than customers, to carry more responsibility for security outcomes.
The effect is cultural as much as regulatory. Choosing a memory-unsafe language for a new network-facing component now invites questions that would have seemed unusual a decade ago, and many engineering leaders find it easier to justify safer defaults than to explain avoidable vulnerabilities after the fact.
“The cheapest memory bug to fix is the one the compiler refuses to let you write.
03Rust, and the alternatives
Rust has become the emblem of the movement because it offers memory safety without a garbage collector, which preserves the performance and predictability that systems programmers need. Its ownership model catches many errors at compile time, and its tooling, including a package manager, formatter, and linter, gives teams a cohesive developer experience.
Adoption has spread across operating system components, browsers, cloud infrastructure, networking software, and embedded work. Several major open source projects now accept Rust code, and some have built interoperability layers to allow gradual introduction.
Rust is not the only path. Managed languages such as Go, Java, C#, and Swift provide memory safety through runtime mechanisms and suit many services where raw control is unnecessary. For existing C++ codebases, organizations are investing in safer idioms, bounds-checked containers, sanitizers, fuzzing, and static analysis. Hardware features that detect or mitigate memory errors add another layer of defense.
| Approach | Strengths | Trade-offs |
|---|---|---|
| Rust | Compile-time safety, no garbage collector, strong tooling | Learning curve, interop effort, smaller talent pool in some regions |
| Managed languages | Mature ecosystems, productive, safe by default | Runtime overhead and less control for low-level work |
| Hardened C++ | Reuses existing code and skills | Safety depends on discipline and tooling; gaps remain |
| Sanitizers and fuzzing | Find real bugs in existing code | Detection, not prevention; coverage is never complete |
| Hardware mitigations | Defense in depth with low developer effort | Not universally available; does not remove root causes |
04Why rewrites rarely work, and what does
The instinctive reaction to a memory safety problem is to rewrite everything. Experienced engineers resist this for good reasons. Large codebases embody years of accumulated bug fixes, edge cases, and undocumented behavior. A full rewrite risks reintroducing old bugs, takes far longer than expected, and pauses feature development while it happens.
The approaches that work are incremental. Write new components in a memory-safe language, so the volume of unsafe code stops growing. Prioritize rewriting the riskiest parts first: code that parses untrusted input, handles network traffic, or runs with high privileges. Wrap and isolate the legacy portions while the new code takes on more responsibility over time.
Evidence from large projects suggests an encouraging dynamic: because most vulnerabilities are found in recently written or modified code, simply ensuring that new code is memory safe can reduce risk meaningfully even before old code is touched. Over time, as older code ages and stabilizes, the proportion of new vulnerabilities declines.
05The practical hurdles
Interoperability
Real systems mix languages. Calling between Rust and C or C++ requires careful boundaries, and the bridge itself can become a source of unsafe code. Tools that generate bindings and enforce conventions help, but teams should plan for time spent on interface design.
Tooling and build complexity
Adding a new language affects build systems, continuous integration, debugging, profiling, and packaging. These are solvable problems, yet they consume real effort, particularly in organizations with long-established build infrastructure or strict reproducibility requirements.
People and skills
Developers fluent in systems programming can learn memory-safe languages, though the early weeks can feel frustrating as new rules push back on familiar habits. Teams that invest in training, pairing, and internal examples recover productivity faster, and many report that the compiler’s strictness becomes a source of confidence rather than friction.
Embedded and constrained environments
Microcontrollers and real-time systems have special constraints around size, determinism, and toolchain support. Progress is being made, but teams in these domains should evaluate maturity carefully rather than assume parity with desktop and server ecosystems.
06What it means for different teams
Publish a memory safety roadmap. Set a default of memory-safe languages for new network-facing and parsing components, and track progress.
Map vulnerability history to find which components generate the most memory bugs, and use that data to prioritize investment.
Budget time for interface design, tooling, and training. Treat the migration as a multi-year program rather than a quarter-long project.
Ask suppliers about their memory safety practices and roadmaps, particularly for components that process untrusted data.
Learn one memory-safe systems language, practice reading unsafe code critically, and use sanitizers and fuzzers on existing projects.
- ✓Enable compiler hardening flags and sanitizers in CI
- ✓Add fuzzing to parsers and other untrusted-input code
- ✓Choose a memory-safe language for new, exposed components
- ✓Identify the top five riskiest legacy modules by exposure and bug history
- ✓Define and document safe FFI boundaries between old and new code
- ✓Budget training time and pair experienced developers with newcomers
07Where this is heading
Several trends are converging. Language ecosystems are maturing, with richer libraries and better tooling for mixed-language projects. Standards bodies and open source communities are discussing safer subsets and profiles for existing languages. Research into automated translation of legacy code is also advancing, though it remains an assisted, review-heavy process rather than a push-button solution.
AI-assisted tools may help with parts of the migration, such as proposing translations and generating tests, but the same caution applies: verified behavior, careful review, and incremental rollout remain essential. Translating code is not the same as understanding why it was written that way.
Over the long run, the likely outcome is not a world without C or C++, but one in which the riskiest, most exposed code is increasingly written in safer languages, and where unsafe code is smaller, better isolated, and more heavily tested.
This analysis was prepared by the Aovory Team for general informational purposes. Product capabilities, regulations, and timelines change quickly, so verify details with official vendor and regulator sources before making decisions.
