weird VC++ compile warning

Started by
8 comments, last by Possibility 23 years ago
Ok, I am getting a weird warning when compiling my VC++ program: Linking... Debug/Full Test.exe : warning LNK4084: total image size 318128128 exceeds max (268435456); image may not run Creating browse info file... Full Test.exe - 0 error(s), 1 warning(s) Now what does this image size mean and why is it so large? Its just a normal program and it runs fine, altough it takes a few seconds to open, but it doesnt use more then 256megs or ram or anything, which is the amount of ram I have. Possibility
Advertisement
Looks like you have a serious memory leak... maybe a macro... also if you include resourses ( like a 30 minutes wav file ) this can be huge and bloat your exe...
quote:
but it doesnt use more then 256megs or ram or anything, which is the amount of ram I have

LOL, that''s ALOT of ram.

Magmai Kai Holmlor
- The disgruntled & disillusioned
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
quote:
but it doesnt use more then 256megs or ram or anything, which is the amount of ram I have



318128128 bytes
318128128 / 1024
= 310672 kilobytes

310672 / 1024
= 303.39 megabytes!!

Remember Windows has to go somewhere (thats around 24Mb running), as do any dynamic allocations.

It will probably work because the memory will be backed up by the virtual memory system (the swapfile/pagefile), and I doubt all of those 303.3Mb of pages are being touched regularly.

I guess that most of that is resources for a demo/game - putting them into the .exe is a bad idea (slower loading + bad virtual memory thrashing + less likely to run) - better would be to split the resources off into a separate file and use file mapping (MapViewOfFile etc) to access them when needed (rather than requiring that all is loaded before being able to run).


If you don''t have loads of resources, then its likely you had a crash and something screwed up one of your project files - delete the Debug and Release folder and do a Clean then a Rebuild All.


--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Are you sure it means RAM? I think image size is the size of the executable. Besides, the linker couldn''t possibly know how much RAM the application would use when its run. Apparently the file is 300 megabytes, which is absurd. My guess is Possibility compiled a huge amount of models and textures as resources in the program, instead of loading them at run-time from external files.

~CGameProgrammer( );

~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
Its a warning about the size of the final executable file (which happens whenever the .exe is over 256Mb).

The reason for the compiler issuing the warning is related to RAM - ie. "are you mad, this will never fit in memory on most peoples machines".
The problem is that Windows nor the compiler really know how spaced out those pages are so the code could potentially be asking for access to more of them than would fit in memory.

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

no no guys, your all confused, hehe.
The executable is only 1.01 megs, and it does NOT use more then a couple megs of ram. There are no resouces, its only displaying a single .x file (the tiger.x from the sdk) and a simple cylinder with the tiger.bmp wrapped around it. Thats all.

All I have basically done was modify the Pick example from the sdk. So I know the image size doesnt mean executable size and it doesnt mean the ram size (how could the compiler know how much ram the program is gonna use anyways), so what could it mean then?

Possibility
By definition,image size is the size of the PE file (the executable, DLL, etc.)
I figured it out, it means the amount of ram the program will require at a minimum when it runs. I have a terrain map, I put in an array of 5000x5000 (hard coded into the game) to see if it would run. I have 256 megs of ram. The code is for a research project and will be running on a comp with 768megs of ram. It does run fine on both comps with the 5000x5000 tiles. When i reduced the array size for running on my home comp, it was still giving that compiler warning when it didnt need to, but when I did a full rebuild, then that warning went away.

Possibility
I''d say that making a huge array is one way to make the image big. "image" means a mirror image of your global and static variable declarations, including the code.
VK

This topic is closed to new replies.

Advertisement