Memory-safe language
A programming language that manages memory and checks bounds for the programmer, so whole classes of memory error, such as buffer overflows and use after free, do not arise in its ordinary code.
A memory-safe language is one whose compiler or runtime enforces correct use of memory, commonly by checking bounds and by managing when memory is freed, through garbage collection or compile-time ownership rules. In its ordinary code, out-of-bounds writes, use after free and similar faults do not arise from a programmer’s oversight. Common examples include Rust, Go, Java, C#, Swift and Python. C and C++ are the usual counterexamples, leaving memory management and bounds checking to the programmer. CISA and the NSA make the case for adoption in their joint guide Memory Safe Languages: Reducing Vulnerabilities in Modern Software Development (June 2025).
Memory safety removes a class of weakness, not every weakness. Many such languages allow explicitly unsafe code or calls into C libraries, where the guarantee lapses, and none of them prevents SQL injection, cross-site scripting or missing authorisation. In code written in C or C++, the root fix for a buffer overflow remains bounds checking at each write, while data execution prevention and ASLR only make exploitation harder. Language choice is therefore an early risk decision, separate from whether code is compiled or interpreted.
Exam relevance: a scenario about preventing buffer overflows in new development is likely to favour a memory-safe language. Candidates are expected to see that it removes memory errors, not logic or injection flaws.