首页 > 其他 > 详细

C Debugging Note

时间:2019-02-28 11:37:41      阅读:125      评论:0      收藏:0      [点我收藏+]

==Updating==


Memory leak issues:

  • Assigning NULL to a dynamically allocated memory block. Will not be freed later.
    char ** arg = calloc(1, sizeof(char *));
    arg[0] = calloc(10, sizeof(char));
    arg[0] = NULL;
    free(arg); // MEMORY LEAK!
  • Rewriting to a freed memory block.

    In some weird cases, the programme will run smoothly for several steps (writing) and then throw a segmentation fault error.

  • Always draw a diagram for the changes you made.

C Debugging Note

原文:https://www.cnblogs.com/manqing/p/10448860.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!