Memory leak tool tells me zero leaks but memory footprint keeps rising

前端 未结 6 1416
悲哀的现实
悲哀的现实 2021-01-23 06:42

I\'m running through some memory profiling for my application in SDK 3.2 and I used the \'Leak\' profiler to find all my memory leaks and I plugged all of them up. This is a sc

6条回答
  •  猫巷女王i
    2021-01-23 06:55

    To reiterate:

    char *str1 = malloc(1000);
    char *str2 = malloc(1000);
      .
      .
      .
    char *str1000 = malloc(1000);
    

    is not a memory leak, but

    char *str1 = malloc(1000);
    char *str1 = malloc(1000);  //Note! No free(str1) in between!
    

    is a memory leak

提交回复
热议问题