关于 Segmentation fault

由于程序运行老是有 Segmentation fault 的错误,即使是象上一篇文章中讲的那样改了,也还是可能碰到,于是上网找了找,发现了这样一些东西。

首先是一段英文的东西,是最先找到的,大概就是说是因为指针,数组的不恰当使用造成分段内存访问时的错误,这里就不翻译了。

One of the most common problems when making software is errors like "Segmentation fault", also called SegFault. Here is what a SegFault is. Virtual memory in a computer can be created in 2 ways: pages or segments. Paging means that the memory is divided in pages of equal size, containing words of memory in it. Segmentation means that every process has a segment of memory of needed size, with gaps of empty memory blocks between the segments. The operating system knows the upper limit of every segment, and every segment begins at a virtual address 0. When a program accesses a memory block, it calls a virtual address that the Memory Management Unit (MMU) maps to a real address. If the operating system sees that the requested address doesn't match any valid address in the segment, it will send a signal to the process terminating it. SegFaults are the direct result of a memory error. The program has a bad pointer, a memory leak or any kind of error that makes it access the wrong memory address. To correct these errors you need to check pointers and arrays for errors.

进一步查找,发现有这样一个帖子,这里我就不帖原文了,大家要看可以到这里看看,应该还是有帮助的

http://www.linuxforum.net/forum/gshowflat.php?Cat=&Board=program&Number=414847&page=0&view=collapsed&sb=5&o=all&fpart=

似乎知道问题,那么去解决问题就可以了,但是,去看看那个编译能通过但不能执行的ezx的hello的例子,还是搞不清那个地方就有指针或者数组的错误,先写到这,等问题解决了再来吧。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值