Results 1 to 5 of 5

Thread: To high compiler memory consumption > 8 GB

  1. #1
    Join Date
    Feb 2015
    Location
    Poland
    Posts
    34
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Exclamation To high compiler memory consumption > 8 GB

    Hi
    I have small console application which loads database witch sample data and copies images into server working directory (server is other app). In that app I have resource file with 180 images various sizes, but less than 10MB in total. I try build (debug) this app on machine with 2GB RAM + 3GB swap, but it failed (it reports that RAM is not enought).So I increase swap size to 20GB and I observe that it uses 2GB RAM + 6GB swap (8GB in total) to compile that small app!!! Compile release version uses only little less memory (7,6GB)!!! Please clarify whether qt resurorce is not good for many files? I planed hundredths (or even thousands) files stored in exe (I want hide everything from user). Should I store my images in zip file and then embedded it in to my exe? And then copy it from exe into Temp dir and extract images and then copy them to its destination?

    My enviroment is: Windows 10 64bit, VC++ 15, Qt Creator 4, Qt 5.6

    Thank you. Best regards.
    Szyk Cech

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: To high compiler memory consumption > 8 GB

    Are you referring to the memory required by VC++ or can you be more specific which tool is requiring so much memory? The resource file you reference wouldn't seem to require any where near that much memory.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: To high compiler memory consumption > 8 GB

    If you look at the files generated by rcc for the source files, you will see that each file gets converted into a block of data, basically a char array.
    These files then need to be compiled.

    If you have a large amount of data in a single resource file, then the resulting generated code gets very large, stressing the compiler when it processes them.

    One option is to use several resource files, each with a smaller amount of data.

    Cheers,
    _

  4. #4
    Join Date
    Feb 2015
    Location
    Poland
    Posts
    34
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Exclamation Re: To high compiler memory consumption > 8 GB

    In *.pro file I need to add this line:
    Qt Code:
    1. CONFIG += resources_big
    To copy to clipboard, switch view to plain text mode 
    And now it compiles as expected...
    Last edited by Szyk; 27th June 2016 at 14:51.

  5. #5
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: To high compiler memory consumption > 8 GB

    Awesome, glad you found a workaround!
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

Similar Threads

  1. QProcess doesn't start when memory consumption is too high
    By bibhukalyana in forum Qt Programming
    Replies: 7
    Last Post: 13th November 2013, 09:32
  2. Qt 4.6.3 QString and memory consumption
    By webquinty in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 10th April 2012, 15:45
  3. QString memory consumption
    By sicker in forum Newbie
    Replies: 1
    Last Post: 4th November 2011, 16:23
  4. QSqlQueryModel and memory consumption
    By lunatic fringe in forum Qt Programming
    Replies: 3
    Last Post: 5th February 2010, 11:09
  5. Replies: 0
    Last Post: 17th November 2009, 21:19

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.