MoveSemantics

ThoughtStorms Wiki

C has memory leaks because you allocate memory on the heap and don't give it back.

You can get around this with a VirtualMachine and GarbageCollection but this is runtime overhead.

An alternative is to have the compiler track the number of references to things, and who owns them at any time.

A BorrowChecker is like a type-checker. It's part of the compiler and runs at compile time. But checks who has got and who must de-allow / destroy an object before the end.

CPlusPlus has Move semantics in the latest version.

RustLanguage has them too.