HeapCreate,Linux中的HeapAlloc,Linux上的私有分配器 [英] HeapCreate, HeapAlloc in Linux, private allocator for Linux

查看:638
本文介绍了HeapCreate,Linux中的HeapAlloc,Linux上的私有分配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows中,对于非常苛刻的应用程序,程序员可以使用HeapCreate,HeapAlloc以便更好地管理和控制内存的分配速度(也称为私有分配器)。在Linux c ++编程中是什么等价的?

In Windows, for very demanding applications, a programmer may use HeapCreate, HeapAlloc in order to better manage and control the allocation of memory- speed it up (aka private allocators). What is the equivalent in Linux c++ programming?

推荐答案

如果要使用自己的私有分配器,请使用 mmap()将一定量的内存映射到进程中,然后可以根据需要使用该内存。打开一个文件描述符到 / dev / zero ,然后使用它作为'fildes'参数 mmap() 。有关要传递的参数的完整详细信息,请参阅 man mmap 。在这方面, mmap()扮演与 HeapCreate()相同的角色。

If you want to use your own private allocator, then use mmap() to map an amount of memory into your process, then you can use that memory as you like. Open a file descriptor to /dev/zero, and then use that as the 'fildes' parameter to mmap(). See man mmap for full details of the parameters to pass. In this respect mmap() plays the same role as HeapCreate().

这篇关于HeapCreate,Linux中的HeapAlloc,Linux上的私有分配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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