Ways to avoid Memory Leaks in C/C++

前端 未结 6 774
面向向阳花
面向向阳花 2020-12-25 09:18

What are some tips I can use to avoid memory leaks in my applications? In my current project I use a tool \"INSURE++\" which finds the memory leak and generate the report. <

6条回答
  •  一向
    一向 (楼主)
    2020-12-25 09:52

    Use a smart pointer, such as std::shared_ptr (C++0x), std::tr1::shared_ptr (TR1), or boost::shared_ptr. Of course this solution only works with C++ -- you're on your own in C.

提交回复
热议问题