I am trying to complete a college assignment, and the marking criteria specifies 5% for memory management – specifically for having no memory leaks.
As I understand it, memory leaks in simple C programs, are only caused by pointers which have become abandoned by the program – ie, malloc/calloc/etc calls which are never have a corresponding free.
My question is in 3 parts:
- Whats the simplest way on Solaris
and OSX to ‘prove’ that you haven’t
leaked any memory? - Does XCode have
any tools to help determine memory
leaks? - Does the operating system
release all previously allocated
memory within a c program once the
process ends?
Valgrind is your friend.