什么是“记忆跺脚”? [英] What is a “memory stomp”?

查看:99
本文介绍了什么是“记忆跺脚”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚碰到这个博客帖子其中提到踩内存

I just came across this blog post which mentions "stomping memory":

C ++程序是很容易能够跺脚内存
      (你可能从来没有听说过,如果你是的
      出生在一个管理code的世界。)

a C++ program which is easily capable of stomping memory (something you probably have never even heard of if you were born in a managed code world.)

事实上,我从来没有听说过呢!

And in fact I have never heard of it!

那么,这是什么,是内存跺脚,跺脚的记忆?它发生的时候?

So, what is this, a memory stomp, stomping memory? When does it occur?

推荐答案

内存践踏的时候了一块code操纵内存,而没有意识到另一块code的使用内存的方式,冲突。有几种常用的方法内存可以跺着脚。

Memory is "stomped" when a piece of code manipulates memory without realizing that another piece of code is using that memory in a way that conflicts. There are several common ways memory can be stomped.

一个是分配,也就是说,100个字节的内存,但随后存储的东西过去100地址。这种内存可以用来持有完全不同的东西。这是特别难以调试,因为当一些试图访问于跺着脚受害人会出现问题,而code其上跺着脚可能是风马牛不相及。

One is allocating, say, 100 bytes of memory but then storing something past the 100th address. This memory might be used to hold something completely different. This is particularly hard to debug because the problem will appear when something tries to access the victim that was stomped on, and the code that stomped on it may be totally unrelated.

被释放后另一个是访问内存。存储器可以被分配用于另一目的。同样,code,显示问题可能会涉及到新分配的对象,得到了相同的地址和无关的code引起的问题。

Another is accessing memory after it was freed. The memory may be allocated for another object. Again, the code that shows the problem may be related to the newly-allocated object that got the same address and unrelated to the code that caused the problem.

这篇关于什么是“记忆跺脚”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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