Is there way to verify my program has no memory leaks?
问题 I wish to determine if the following program (an implementation of finding the maximum sub-array) leaks memory. Is there a general way to determine this? Such as using some feature of a debugger? What are general strategies? struct Interval { int max_left; int max_right; int sum; }; struct Interval * max_crossing_subarray(int A[], int low, int mid, int high) { struct Interval * crossing = malloc(sizeof(struct Interval)); int left_sum = INT_MIN; int sum = 0; for(int i = mid; i >= low; --i) {