回 帖 发 新 帖 刷新版面

主题:CVF6.5 计算内存大于256M 内存不足如何解决

Debug/top.exe : warning LNK4084: total image size 1376534528 exceeds max (268435456); image may not run

回复列表 (共2个回复)

沙发

以下是官方解释,说白了就是静态数组太大,建议改为动态数组。

[quote]Q1019 - Linker warning: "LNK4084 - total image size exceeds max (268435456); image may not run"

Platforms: All
Versions: All
Fixed in version: N/A
Article created: 08 June 1998
Article revised: 16 September 2002

Description: When linking an application which contains large arrays, the linker gives the warning "LNK4084 - total image size exceeds max (268435456); image may not run".

Explanation: Windows 95 and Windows NT 4.0 have a limit for the total size of static code and data of 256MB. If the amount of static code and data exceeds this size, the image may not execute. This is a limitation in the operating system and not in Visual Fortran or its tools. The most common cause of large static data is large local or COMMON arrays. The linker issues an informational warning in this case to alert you of the potential problem.

However, if the actual image size is displayed as a negative value, that means that the image size exceeds 2GB and your program will not run on any version of 32-bit Windows.

Solution: For Windows NT 4.0, install Microsoft's Windows NT Service Pack 3 (or later). This raises the limit on static code and data to 1.75GB. However, the linker is not modified by this update and will continue to issue the warning, which can be ignored. The limit on Windows 98, Windows 2000 and Windows XP is 1.75GB, the same as Windows NT 4.0 with Service Pack 3 - if your application will be not be running on Windows 95, or on Windows NT 4.0 prior to SP3, and the actual image size is not displayed as a negative value, you can ignore this message.

For Windows 95, Microsoft has not released an update which raises the limit.

If you wish to prevent the message from being issued when you link, select Project..Settings..Link. At the end of the Project Options box, type in:

/ignore:4084

An alternative is to make the large arrays ALLOCATABLE. Dynamically allocated data is not subject to the 256MB limit.

Example #1: Local array

Old:

REAL BIG_ARRAY(1000,1000,500) !500MB

New:

REAL,ALLOCATABLE :: BIG_ARRAY(:,:,
...
ALLOCATE (BIG_ARRAY(1000,1000,500))
! ALLOCATE statement goes in executable
! part of program

Example #2: Common array

Old:

! Include file declaring COMMON array
REAL BIG_ARRAY(1000,1000,500) !500MB

New:

! New source file containing MODULE as follows
MODULE BIG_STUFF
REAL,ALLOCATABLE::BIG_ARRAY(:,:,
END MODULE BIG_STUFF

! Add to routines using BIG_ARRAY
USE BIG_STUFF

! Add to main program
USE BIG_STUFF
...
ALLOCATE (BIG_ARRAY(1000,1000,500)

Note that USE statements must immediately follow PROGRAM, SUBROUTINE or FUNCTION statements. For more information on MODULE, USE and ALLOCATABLE arrays, see the Language Reference Manual.[/quote]

板凳

其实还是可以运行的,单精度的结果基本上没什么大问题。

我来回复

您尚未登录,请登录后再回复。点此登录或注册