2 ms·
You can do manual memory management in .NET since the early days, it was designed to support C++ as well, first with Managed Extensions for C++, and then C++/CL
by pjmlp 10mo ago
You can do manual memory management in .NET since the early days, it was designed to support C++ as well, first with Managed Extensions for C++, and then C++/CLI on .NET 2.0
So there were ways to do it, but not as straightforward from C# and co.
What Microsoft has been doing since the Core rewrite is exposing those capabilities in a more natural way, especially since C++/CLI is Windows only as it relies on Visual C++ backend.
As for the use after free, you can get a bit around it with using and Roslyn analysers, but yeah it would be better if directly supported on the language.
Note that manual memory management is exposed via System.Runtime.InteropServices.Marshal class. It exposes several ways to do it.