64位内存分配 [英] 64bit Memory allocation

查看:269
本文介绍了64位内存分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求在C创建德尔福兼容的dll ++做简单的64位内存管理。

I've been asked to create a Delphi compatible dll in C++ to do simple 64bit memory management.

的背景是,该系统在Delphi中需要分配大量内存块,将顺利之外的32位寻址空间。德尔福开发商向我解释说,他无法分配内存与德尔福命令提供给他。他说,他可以容纳64位地址,所以他只是想调用一个函数我提供给分配内存和一个64位的指针回到他身边。然后另一个函数后释放内存。

The background is that the system in Delphi needs to allocate a lots of chunks of memory that would go well outside 32bit addressable space. The Delphi developer explained to me that he could not allocate memory with the Delphi commands available to him. He says that he can hold a 64bit address, so he just wants to call a function I provide to allocate the memory and return a 64bit pointer to him. Then another function to free up the memory later.

现在,我只有VS 2008在我手上所以,首先我什至不知道我能在第一时间创建一个Delphi兼容的DLL。

Now, I only have VS 2008 at my disposal so firstly I'm not even sure I can create a Delphi compatible dll in the first place.

任何德尔菲专家关心帮助我。也许有一种方式来实现他需要,而无需重新发明轮子。其他的开发人员必须所遇到的这之前,德尔福。

Any Delphi experts care to help me out. Maybe there is a way to achieve what he requires without re-inventing the wheel. Other developers must have come across this before in Delphi.

所有评论AP preciated。

All comments appreciated.

推荐答案

只有64位进程可以寻址64位内存。 64位进程只能加载64位DLL和32位进程只能加载32位的DLL。德尔福的编译器只能使32位二进制文​​件。

Only 64 bit processes can address 64 bit memory. A 64 bit process can only load 64 bit dlls and 32 bits processes can only load 32 bits dlls. Delphi's compiler can only make 32 bits binaries.

因此​​,一个32位的德尔福exe文件不能加载您的64位C ++ DLL。它可以装入一个32位的C ++ DLL,但随后即DLL将不能够处理64位的存储器空间。有种你被卡住这个解决方案。

So a 32 bits Delphi exe can not load your 64 bit c++ dll. It could load a 32 bit c++ dll, but then that dll wouldn't be able to address the 64 bit memory space. You are kind of stuck with this solution.

德尔福可以,用正确的编译器选项和Windows切换的内存地址3GB没有问题。甚至更多的内存可以通过一个32位的过程中,如果使用物理地址扩展访问。然后,它需要交换内存页的进出32位的内存通过使用地址的窗口扩展

Delphi could, with the right compiler options and Windows switches address 3GB of memory without problems. Even more memory could be accessed by a 32 bits process if it uses Physical Address Extension. It then needs to swap memory pages in and out of the 32 bits memory through the use of Address Windowing Extensions.

这篇关于64位内存分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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