Archived

This topic is now archived and is closed to further replies.

weird VC++ compile warning

This topic is 6113 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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( );

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites