[转]IDL: Unable to allocate memory 内存问题_IDL:In...

来源:百度文库 编辑:神马文学网 时间:2024/04/29 05:17:45
[转]IDL: Unable to allocate memory 内存问题2008年03月03日 星期一 09:20

之前写了一片关于不能分配内存的问题,没有详实的说明。今天发现Ylandy将此问题详细描述,收藏一下!

出错:

IDL> sino_cross_homo = fltarr(512, 127, 688)
IDL> sino_cross_homo = FFT(FFT(sino_cross_homo, DIMENSION=1),DIMENSION=2)
Unable to allocate memory: to make array.
Not enough space

------------------------------------------------------------------------------------

http://www.ittvis.com/services/techtip.asp?ttid=3346

IDL:允许使用所有可以使用的内存

限制主要来自Physical Memory,virtual memory ,装的OS的限制,连续内存

说常见问题

第一   os: Operating System Available Address Space Windows NT Workstation and Windows Server-class systems 2 Gigabytes Certain Windows Server-class systems (including NT/2000/2003 Server and XP Professional) 3 Gigabytes

 

windows:默认为2G,需要打开3G开关

(不过盗版的,我试过一次没有成功,没有找到原因)

http://zhidao.baidu.com/question/11864255.html?si=1

物理地址扩展 (PAE) X86 概述

物理地址扩展 (PAE) X86 允许软件使用地址窗口扩展 (AWE) API 集并在具有 Intel Pentium Pro 或更高版本处理器的计算机上运行,而 4 GB 以上物理内存允许将更多物理内存映射为应用程序的虚拟地址空间。

如何启用物理地址扩展 (PAE)

启用物理地址扩展 (PAE) X86

1.打开 Windows 资源管理器。

2.在“工具”菜单上,单击“文件夹选项”。

3.在“查看”选项卡上,单击“显示所有文件和文件夹”,清除“隐藏受保护的操作系统文件”复选框,然后单击“确定”。如果显示警告对话框,单击“是”以继续。

4.在根文件夹(如 C:)下查找 Boot.ini 文件并删除它的只读属性。

5.打开 Boot.ini 文件,然后将 /PAE 参数添加到 ARC 路径中,如以下 Windows Server 2003 Datacenter Edition 示例所示:

multi(0)disk(0)rdisk(0)partition(2)\%systemroot%="Windows Server 2003, Datacenter Edition" /PAE

6.在“文件”菜单上,单击“保存”。

7.还原 Boot.ini 文件的只读属性。

8.为使更改生效,请重新启动计算机。

禁用PAE模式方法

右击桌面“我的电脑”属性,选择“高级”,再点击“启动与恢复”下面的“设置”,再点击框中的“编辑”键,此时会打开BOOT.INI文件,

然后将文件的此行“multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect”中的/noexecute=optin改成/execute 改完后保存该文件,然后重启电脑便OK。

 

第二 Memory Fragmentation

iDL是基于MFC库,所以同样受限于malloc() (需要 a single contiguous block of memory)的最大开辟1.2G的array,一般的1G左右(dos系统,可以1.9G)

一个ITT介绍的不太实用的方法:Visual C++ 下的editbin.exe,可以帮助IDL增加100-200M使用空间,在DOS下,输入/rebase

实用的: allocating memory in a correct manner: Persistent allocations first, transient allocations, particularly the large ones, after, and freed at the earliest possible moment.

良好的习惯:a) 连续分配 初始化;b)及时释放内存(temporary)

-----------------

IDL 有自己的内存分配和优化机制,详见http://www.ittvis.com/services/techtip.asp?ttid=3346