2

how to check memory leaks in a c++ code. Are there any free tool for checking memory leaks

Gjordis
  • 2,540
  • 1
  • 22
  • 32
user2086002
  • 41
  • 1
  • 5
  • For UNIX or UNIX-like systems (e.g. OSX, BSD, Linux), there's [Valgrind](http://valgrind.org/). – Some programmer dude Feb 19 '13 at 06:57
  • For Windows, read e.g. [this article](http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx). – Some programmer dude Feb 19 '13 at 06:58
  • Depending on the platform, this might be a duplicate of either http://stackoverflow.com/questions/5195220/tools-to-determine-memory-leak-in-a-c-c-code or http://stackoverflow.com/questions/4720890/check-memory-leaks-in-windows. – jogojapan Feb 19 '13 at 06:59
  • You'll find many existing questions on this topic already. – LihO Feb 19 '13 at 07:43
  • Best tool for memory leak detection I've ever used was [Deleaker](http://www.deleaker.com/). Too bad it's not completely free. – LihO Feb 19 '13 at 07:45

2 Answers2

3

http://valgrind.org/

This is a good tool for Linux, can also be found on most distro's package-handler.

Ajith
  • 613
  • 1
  • 15
  • 32
Gjordis
  • 2,540
  • 1
  • 22
  • 32
  • Actually, I need to check memory leak in an embedded system. IDE is HEW and we are using uCOSIII RTOS. Valigrind does nt support fr the above configurations. so can u pls suggest me a tool or a method to check memory leak – user2086002 Feb 19 '13 at 09:40
3

Yes there it. Check out valgrind. It can do lots of useful things, including detecting memory leaks.

NPE
  • 486,780
  • 108
  • 951
  • 1,012
  • Actually, I need to check memory leak in an embedded system. IDE is HEW and we are using uCOSIII RTOS. Valigrind does nt support fr the above configurations. so can u pls suggest me a tool are a method to check memory leak – user2086002 Feb 19 '13 at 09:31