Are memory leaks possible in managed environments like .NET?

后端 未结 7 1243
梦谈多话
梦谈多话 2021-01-05 02:58

In C++ it is easily possible to have a permanent memory leak - just allocate memory and don\'t release it:

new char; //permanent memory leak guaranteed
         


        
7条回答
  •  情话喂你
    2021-01-05 03:36

    You can write unmanaged code in .NET if you wish, you have enclose your block of code with unsafe keyword, so if you are writing unsafe code are you not back to the problem of managing memory by yourself and if not get a memory leak?

提交回复
热议问题