Computer Science Canada How can you tell if there is a memory leak? |
Author: | HazySmoke)345 [ Mon Jan 08, 2007 4:52 pm ] |
Post subject: | How can you tell if there is a memory leak? |
Besides the fact that you can try to run your program 1000 times and see if it crashes, is there actually a way to figure out whether there's memory allocated by malloc() that hasn't been freed? Thanks. |
Author: | md [ Mon Jan 08, 2007 5:10 pm ] |
Post subject: | RE:How can you tell if there is a memory leak? |
Yes, using other libraries and tools; what they are called I do not know. You can also try writing your own malloc wrapper that counts allocations and deallocations; then you could get current memory usage. |
Author: | Null [ Tue Jan 09, 2007 9:08 pm ] |
Post subject: | RE:How can you tell if there is a memory leak? |
Or you could use tools such as valgrind. It will report memory leaks and segfaults and where they occur. |
Author: | r.3volved [ Tue Jan 09, 2007 9:59 pm ] |
Post subject: | RE:How can you tell if there is a memory leak? |
I use the boost library It's auto unit test helps me out a lot |
Author: | HazySmoke)345 [ Wed Jan 10, 2007 12:25 am ] |
Post subject: | Re: How can you tell if there is a memory leak? |
Thanks guys, I'll try and see if I can work with them. |