LNK4084 – total image size exceeds max (268435456)(256MB); image may not run
(2012-04-09 20:58:19)
标签:
it |
分类: VC |
首先,要知道什么是image(
executable image )?
Linker warning:
“LNK4084
– total
image size
exceeds max
Platforms: All
Fixed in
version: N/A
Article created:
08 June
1998
Article revised:
16 September
2002
Description: When
linking
the linker
gives the
warning “LNK4084 –
total
image size
exceeds max
(268435456);
image may
not execute.
This
is
a limitation
in the
operating system
and not
in Visual
Fortran or
of large
static data
is large
case to
alert you
of the
However, if
the actual
image size
is displayed
as a
negative value, that
means
your program
will not
run on
Solution: For
Windows NT
4.0,
install Microsoft’s
Windows NT
Service
to 1.75GB.
However,
the linker
will continue
to issue
the warning,
which can
be ignored.
The
limit
on Windows
98, Windows
2000 and
Windows NT
4.0 with
Service Pack
3 –
if your application
will be
not be
running on
Windows 95,
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
/ignore:4084
An alternative
is to make
to the
256MB limit.
Example #1:
Local array
Old:
REAL
New:
REAL,ALLOCATABLE ::
…
ALLOCATE
! ALLOCATE
statement
goes in
executable
! part
of
program
Example #2:
Old:
! Include
file declaring
COMMON
array
REAL
BIG_ARRAY(1000,1000,500) !500MB
New:
!
New source
file containing
MODULE as
follows
MODULE BIG_STUFF
END MODULE
! Add
to
USE BIG_STUFF
! Add
to main
USE BIG_STUFF
…
ALLOCATE
(BIG_ARRAY(1000,1000,500)
Note that
USE statements
must
immediately follow
PROGRAM, SUBROUTINE
or
FUNCTION statements.
For more
arrays, see
the Language
Reference
An executable image is a file that acts like a "virtual disk"; when
you open the file, it acts as though it is a disk
drive.
It's a variation on file compression, such as ZIP
or RAR files. Executable images are very common in the Linux /
Macintosh world -- most programs installers are contained in
executable images, for example -- but less common in the Windows
world.
警告LNK4084 – total image
size exceeds max (268435456)(256MB); image may not
run,告诉你生成的 EXE 镜像文件太大,可能无法运行,事实上,如果你可以运行,则完全不必考虑这个警告。
这个警告,一般是因为开辟太大的静态数组导致的。开辟过大的静态数组还会导致bad
executable format (win32 error 193)。
Error 193 is not actually a compiler error. It's a windows system
error that means the you tried to load a bad executable image (not
a EXE, COM, NE or PE). It sounds like one of your compiler's
binaries got corrupted some how. Try reinstalling the binaries for
MSVC.
其原因也可能是rc某些控件删除,exe被杀掉等导致。
(268435456); image may
not run”
详解如下:
Versions: All
an application which
contains large
arrays,
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
its tools.
The most
common cause
local or COMMON
arrays. The
linker
issues an informational
warning in
this
potential problem.
that the image
size exceeds
2GB and
any version of
32-bit Windows.
Pack 3 (or
later).
This raises
the limit on
static code
and data
is not modified
by this
update and
Windows XP is
1.75GB, the
same as
or on Windows
NT 4.0
prior to
SP3, and the
actual image
size is
the Project Options
box, type
in:
the large arrays
ALLOCATABLE.
Dynamically allocated
data is not
subject
BIG_ARRAY(1000,1000,500) !500MB
BIG_ARRAY(:,:,:)
(BIG_ARRAY(1000,1000,500))
Common array
REAL,ALLOCATABLE::BIG_ARRAY(:,:,:)
BIG_STUFF
routines using BIG_ARRAY
program
information on MODULE,
USE and
ALLOCATABLE
Manual.