外部碎片如何发生? [英] How does external fragmentation happen?

查看:208
本文介绍了外部碎片如何发生?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着进程从内存中加载和删除,可用内存空间被分解成小块,导致碎片化……但是这是怎么发生的呢? 外部碎片的最佳解决方案是什么?

As processes are loaded and removed from memory , the free memory space is broken into little pieces ,causing fragmentation ... but how does this happen ? And what is the best solution to external fragmentation ?

推荐答案

外部碎片

当动态内存分配算法分配了一些内存,而剩下的一小块无法有效使用时,就会发生外部碎片.如果发生过多的外部碎片,则可用内存量将大大减少.存在总内存空间可以满足请求,但是不连续. 参见以下示例

External Fragmentation

External fragmentation happens when a dynamic memory allocation algorithm allocates some memory and a small piece is left over that cannot be effectively used. If too much external fragmentation occurs, the amount of usable memory is drastically reduced. Total memory space exists to satisfy a request, but it is not contiguous. see following example

 0x0000 0x1000  0x2000  
   A    B     C               //Allocated three blocks A, B, and C, of size 0x1000.
   A          C         //Freed block B

现在请注意,对于大于B大小的分配,不能包含B使用的内存

Now Notice that the memory that B used cannot be included for an allocation larger than B's size

这篇关于外部碎片如何发生?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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