Linux(或RedHat Linux)上的小块分配器,以避免内存碎片 [英] Small block allocator on Linux (or RedHat Linux) to avoid memory fragmentation

查看:146
本文介绍了Linux(或RedHat Linux)上的小块分配器,以避免内存碎片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道用户应用程序有一个分配器,而不是在HP-UX上处理许多小块分配链接文本和Windows XP 低碎片堆.在HP-UX上可以调整分配器,而在Windows XP上可以将小于16 K的块视为很小.

I know that there is an allocator for user applications than handles lots of small block allocation on HP-UX link text and on Windows XP Low-fragmentation Heap. On HP-UX it is possible to tune the allocator and on Windows XP it considers block of size less than 16 K as small.

我的问题是我找不到关于在Linux(实际上是RedHat Linux)上运行的用户程序的这种分配器的任何信息.如果有这样的分配器,我实际上想找到它可以处理的最大块大小.

My problem is that I can't find any information about this kind of allocator for user programs running on Linux (RedHat Linux actually). If there is such an allocator I actually would like to find what maximum size of blocks it can handle.


更新
我发现了jemalloc( http://www.canonware.com/jemalloc/).它处理小块,大块和大块: http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#size_classes .


Update
I have found jemalloc (http://www.canonware.com/jemalloc/). It handles small, large and huge blocks: http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#size_classes.

推荐答案

Redhat Linux或任何基于Linux的发行版大多使用DL-Malloc(

Redhat Linux or any Linux based distributions mostly use DL-Malloc (http://gee.cs.oswego.edu/dl/html/malloc.html).

对于Kirill指出的用户应用程序,如果由于块较小而导致碎片较多,最好使用单独的内存分配器.

For user applications as Kirill pointed out, better to use separate memory allocators if fragmentation is more because of smaller blocks.

如果用户应用程序较小,则可以尝试使用C ++位置new/delete,它可以覆盖默认分配器模式. ( http://en.wikipedia.org/wiki/Placement_syntax )

If the user application is small, you can try using C++ placement new/delete which can override the default allocator pattern. (http://en.wikipedia.org/wiki/Placement_syntax)

这篇关于Linux(或RedHat Linux)上的小块分配器,以避免内存碎片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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