SSJX.CO.UK
Content

A Guide to Memory Safe Languages

Simply, a memory safe language prevents memory related bugs. These bugs are usually in the form of accessing or setting areas of memory they should not be able to. The problem is the program may continue to run despite the memory having been corrupted meaning the program may give incorrect results. There are tools that can help find possible errors in existing C/C++ code but they are not always reliable. It makes sense to use a language that has safety as a priority when creating new programs and to investigate moving old programs to one of the newer languages.

One method a language may use to be memory safe is through the use of a Garbage Collector (GC). This runs with the program and handles memory allocations and access, if the program tries to access memory it shouldn't, the program will stop and throw up an error. The penalty for using a GC is that they can make the programs slower and they use more memory. These are both becoming less of an issue through more advanced compilers and GC's.

Rust is different in that it uses an ownership memory model which means it does not have or need a GC, memory allocation and access can be verified at compile time.

Languages

This is not an exhaustive list of languages, just the most popular and ones I have actually used. The number of ticks and crosses does not indicate how good or bad a language is, just how many good or bad points I can remember. I may refer to the languages standard library as well as the actual language as well.

Created
18 / 08 / 2024