How to check deallocation of memory

前端 未结 7 1331
猫巷女王i
猫巷女王i 2020-12-03 21:59

How to check if memory to which pointer p points has been succesfully deallocated?

7条回答
  •  無奈伤痛
    2020-12-03 22:26

    1. Some tools which are doing static code analysis can point some problems regarding the memory deallocation.
    2. Use valgrind to check whether you have memory leaks
    3. Avoid raw pointers - use smart pointers instead

提交回复
热议问题