- 关注代码逻辑,是否死循环(但是这个在简单的示例中就能发现)
- 前期申请空间太多,合理安排内存申请
// int **returnArr = (int **)malloc(sizeof(int *) * 1000);
// *returnColumnSizes = (int *)malloc(sizeof(int) * 1000);
int **returnArr = (int **)malloc(sizeof(int *) * (numsSize + 1) * 6);
*returnColumnSizes = (int *)malloc(sizeof(int) * (numsSize + 1) * 6);
3.注意释放内存
/**
- Return an array of arrays of size *returnSize.
- The sizes of the arrays are returned as *returnColumnSizes array.
- Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().
*/