English 中文(简体)
地址范围中的低浓度 4岁
原标题:How to malloc in address range > 4 GiB
  • 时间:2011-03-17 18:45:02
  •  标签:
  • c
  • malloc

I am trying to do some tests on X86_64 Linux, and I want to know how to make malloc() allocate return addresses in the range higher than 4 GiB

Do I have to override malloc with a separate/custom library or is there any other simple way to do this?

感谢。

页: 1

What I am interested is in the address when taken as value (uintptr_t) and it does not matter whether its virtual or physical address, because, all that I want is the address must be a value greater than 4GiB

我正在使用gcc/code>(4.2.1)和-m64,分别使用:

(我明确指出了问题)

最佳回答

<代码>小型()是错误的工具。 页: 1 (是malloc()>,在现代glibc的幕后进行,国际独立调查委员会(关于Unix)。 我认为,温32也有一个类似的情况,但我无法告诉你它是什么。

问题回答

小型公司不给你以某种方式要求地址。 正如其他一些答复中所描述的那样,如果这只是一种检验,那么你就只能把小鼠传给更多的记忆,直到你们得到像你一样的回答,但这种说法非常浪费。

使用毫米() 请大家:

(ADDRESS_ABOVE_4GB, volume, PROT_READ PROT_FRAITE, MAP_ANONYMOUS, -1, 0)

这给你带来了希望,而相对而言,与小鼠一样的杂质。

如果你试图使这种情况发生,就要求你不要控制或主动地像图书馆法一样,提供自己执行上文提到的小公司。

只要你以<代码>gcc-m64 ......(可以是任何途径的违约)汇编成册,并确保包括相关负责人(即:<代码><stdlib.h> 然后,所有工作都应调整工作<>。 点码为64个轨道,size_t为64个轨道,并可 Smalloc 如同你一样,记忆犹如上(最多2^64-1, 无论如何,这应当足以使任何人......。

没有明确的标准方式将<代码>小范围(<>>>>>/代码>用于分配特定范围地址。

然而,你可以分配4名记忆。 如果加以分配,那么空间足够高,则使用该空间。 否则,再分配一些空间;应该用大范围起始地址来分配,但你应当加以检查(因为很小一部分分配可能仍然挤到位于低地址范围的空间),并在所分配的空间高度覆盖之前保持分配。

小流回的地址相当于一个运行系统的凯尔特,它将找到适合大小需要的“灰色”现有记忆体。

如果你想要确保这一地址在一定范围内,那么小孔径的定制版本就是trick,因为实际的记忆分配是从把记忆页数分配给这一过程的。

这基本上意味着剩下的唯一一种技术是,在你耗尽以下4GiB记忆之前,保持小oc,或者也许得到冷 l,并在你想要的范围之内找到一个地址。 请注意,即使如此,也必须汇编你的方案和操作系统,以支持32个轨道地址,这意味着64个轨道结构。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签