All about the “Program too big to fit in memory” error and how to fix it.
Wednesday, October 24, 2007 17:33Have you ever run command line programs that claimed to be “too big to fit in memory”? I have.
Recently when I ran the command line tool gacutil.exe (Global Assembly Cache Utility) to install a .NET assembly I came across a message saying “Program too big to fit in memory”. It was strange because the error came on a machine that had enough free RAM (~2GB) and HD space on it. Surely the gacutil.exe doesn’t need that much memory!
It just so happens that a similar error is given for the Visual Studio .NET product installation file from the MSDN Web site if the installation file was corrupted during the download or if the installation file is not complete. The Microsoft kb 316573 article has more details.
So, this could mean that my gacutil.exe was corrupt. A quick look at the file properties of the gacutil.exe showed that the one I was trying to run was indeed corrupt. So the problem was easily fixed.
But the question remained as to why the error message said what it did. It would have been much easier to figure out and not to mention much more accurate if the error given had said that the program may be corrupt, instead of saying that it was too big to fit into the memory!
A quick search on Google solved the mystery. It seems that this “Program too big to fit in memory” error comes if any one of the following is true
1) The part of the program header that should tell the memory requirements where indicating absurd values
2) The header contains no memory requirement; in which case the program should fit in a 64KB chunk of memory.
We can easily check out the second case by renaming a file (say a text file) to .exe. If the file is larger than 64KB you’d see the “Program too big to fit in memory” error and a “…is not a valid Win32 application” error if the file were less that the 64KB.
A lot more details are available at http://blogs.msdn.com/oldnewthing/archive/2006/01/30/519388.aspx
If you get this error for a compressed archive you could try to repair the file, there are some compression tools that have this feature. If recovery is not possible, then it’s back to downloading a new copy.
Caffiend says:
September 17th, 2008 at 6:12 am
Happened to me also.
In my case, even though the file was indeed "corrupt", there was a workaround, although YMMV. (This was suggested in that same KB article)
Download the compression/decompression utility of your choice - I chose 7-Zip. (The Windows built-in file extractor just doesn’t have all the goods, I guess)
Extract the files.
Et voila, it’s all there. Mind you, this was the Volume Licensing Windows XP SP3 download from eopen.microsoft.com, a pretty hefty file. Didn’t want to have to download that sucker all over again! Anyway, it’s all good now, the extracted files are good enough to perform a successful install