Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How can you tell if there is a memory leak?
Index -> Programming, C -> C Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
HazySmoke)345




PostPosted: 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
Sponsor
sponsor
md




PostPosted: 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




PostPosted: 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




PostPosted: 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




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, C -> C Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: