Line 55: Char 44: runtime error: store to address 0x625000318040 with insufficient space for an object of type 'int *' (solution.c)

  1. 关注代码逻辑,是否死循环(但是这个在简单的示例中就能发现)
  2. 前期申请空间太多,合理安排内存申请
    // 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().
    */
posted @ 2020-10-22 09:52  ginn123  阅读(2025)  评论(0)    收藏  举报