Is there an acceptable limit for memory leaks?

前端 未结 11 2251
無奈伤痛
無奈伤痛 2021-02-02 12:08

I\'ve just started experimenting with SDL in C++, and I thought checking for memory leaks regularly may be a good habit to form early on.

With this in mind, I\'ve been

11条回答
  •  时光说笑
    2021-02-02 12:21

    Be careful that Valgrind isn't picking up false positives in its measurements.

    Many naive implementations of memory analyzers flag lost memory as a leak when it isn't really.

    Maybe have a read of some of the papers in the external links section of the Wikipedia article on Purify. I know that the documentation that comes with Purify describes several scenarios where you get false positives when trying to detect memory leaks and then goes on to describe the techniques Purify uses to get around the issues.

    BTW I'm not affiliated with IBM in any way. I've just used Purify extensively and will vouch for its effectiveness.

    Edit: Here's an excellent introductory article covering memory monitoring. It's Purify specific but the discussion on types of memory errors is very interesting.

    HTH.

    cheers,

    Rob

提交回复
热议问题