Author |
Message |
HazySmoke)345

|
Posted: 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. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
md

|
Posted: 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. |
|
|
|
|
 |
Null

|
Posted: 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. |
|
|
|
|
 |
r.3volved
|
Posted: 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 |
|
|
|
|
 |
HazySmoke)345

|
Posted: 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. |
|
|
|
|
 |
|