什么是总线错误?它与分段错误不同吗? [英] What is a bus error? Is it different from a segmentation fault?

查看:32
本文介绍了什么是总线错误?它与分段错误不同吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

总线错误"是什么意思?消息的意思,它与分段错误有何不同?

What does the "bus error" message mean, and how does it differ from a segmentation fault?

推荐答案

现在 x86 上的总线错误很少见,并且在您的处理器甚至无法尝试访问请求的内存时发生,通常:

Bus errors are rare nowadays on x86 and occur when your processor cannot even attempt the memory access requested, typically:

  • 使用地址不满足对齐要求的处理器指令.

访问不属于您的进程的内存时会发生分段错误.它们非常常见,通常是以下原因造成的:

Segmentation faults occur when accessing memory which does not belong to your process. They are very common and are typically the result of:

  • 使用指向已解除分配的内容的指针.
  • 使用未初始化的假指针.
  • 使用空指针.
  • 溢出缓冲区.

PS:更准确地说,不是操纵指针本身会导致问题.它正在访问它指向的内存(解引用).

PS: To be more precise, it is not manipulating the pointer itself that will cause issues. It's accessing the memory it points to (dereferencing).

这篇关于什么是总线错误?它与分段错误不同吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆