注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

亮丽

一直想安静的过着安静的日子,安静的爱着爱我的人

 
 
 

日志

 
 
 
 

malloc 导致malloc corrupt  

2008-03-21 09:41:37|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

C/C++ software memory corruption types:

There are two forms of Linux Memory accessible to the programmer:

User's virtual memory space in which application is run.
Register memory.
The most obvious memory errors result in a "Segmentation violation" message. This may alert the programmer to the location of the memory error when the program is run in gdb. The following errors discussed are the not so obvious errors.

Memory errors:

Heap memory errors:
Attempting to free memory already freed.
Freeing memory that was not allocated.
Attempting to write to memory already freed.
Attempting to write to memory which was never allocated.
Memory allocation error.
Reading/writing to memory out of the bounds of a dynamically allocated array

stack (local variables) memory errors:
Reading/writing to memory out of the bounds of a static array. (array index overflow - index too large/underflow - negative index)
Function pointer corruption: Invalid passing of function pointer and thus a bad call to a function.

张纪林说: (03-20 22:45)<约10.4小时前>
出现了 memory corrupt
张纪林说: (03-20 22:45)<约10.4小时前>
用环境变量 MALLOC_CHECK_=2就没有错误了
张纪林说: (03-20 22:47)<约10.3小时前>
http://www.yolinux.com/TUTORIALS/C++MemoryCorruptionAndMemoryLeaks.html
张纪林说: (03-20 22:50)<约10.3小时前>
Freeing memory which was not dynamically allocated:
张纪林说: (03-20 22:50)<约10.3小时前>
struct ABC abc;struct ABC *abc_ptr = &abc;...free(abc_ptr);

  评论这张
 
阅读(249)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018