Interpreting leaks

The message for a memory leak includes the following type of useful information detail:

For a list of error messages returned by the Memory Analysis tool, see Summary of error messages for Memory Analysis.

How to address resource (memory) leaks

To address resource leaks in your program, ensure that memory is deallocated on all paths, including error paths.


The following code shows an example of a memory leak:

int main(int argc, char ** argv){
            char * str = malloc(10);
            if (argc>1) {
            str = malloc(20);
            // ...
            printf("Str: %s\n",str);
            return 0;
Related tasks
Enabling leak detection
Detecting leaks on demand during program execution