PDA

View Full Version : Virtual memory exhausted compiling .qrc



JonnyJP
6th August 2012, 15:36
Hi,

I've added a single 100mb .avi file to a .qrc file but I'm getting the error:

"virtual memory exhausted: Cannot allocate memory"

I have 1.7gb memory and 3.0gb swap allocated in my Virtual Machine. I get this error when I load a 20mb tiff image too.

The problem seems to be identical to this issue:

http://www.qtcentre.org/threads/38128-virtual-memory-exhausted

Now, the solution would be to remove the .avi from the resources file and load it at run time, I'm fine with that. I'd just like to understand what is going on. Looking at the system monitor my memory usage just increases to the max then it fails the build.

Are the resources loaded multiple times when the moc is compiling? My understanding was the .qrc files would just be loaded into the apps executable, so if you have 100mb of resources the executable grows by 100mb. I'm just scratching my head as to why adding a 20mb resource would max out the RAM.

Any advice is appreciated.

Thanks

Added after 8 minutes:

I've just been reading the documentation on the Qt resource system.

http://doc.qt.nokia.com/4.7-snapshot/resources.html

The section 'compiled in resources' is pretty much what I understood was going on.

ChrisW67
7th August 2012, 03:16
I've added a single 100mb .avi file to a .qrc file but I'm getting the error:

"virtual memory exhausted: Cannot allocate memory"

Exactly what is generating this message? The Qt resource compiler (rcc), the C++ compiler, or the linker? You are asking the compiler and linker to handle a single object (C++ or file) above 100MB (the AVI/TIFF will not compress well) to produce an EXE of similar size. The compiler might choke building a syntax tree for 100000000 bytes in a single array.

JonnyJP
7th August 2012, 10:46
Thanks. It's the compiler that is causing the error.So basically it's just that it can't handle massive source files?