Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Can't create variable of weigth more than 2 Gb
Forum Updated to NodeBB v4.3 + New Features

Can't create variable of weigth more than 2 Gb

Scheduled Pinned Locked Moved Solved C++ Gurus
3 Posts 2 Posters 923 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Please_Help_me_DP Offline
    Please_Help_me_DP Offline
    Please_Help_me_D
    wrote on last edited by
    #1

    Hi all,
    I encountered a problem that bothers me. I know that on x32 bit system a program that were compiled with x32 compilator can't include variable of weight more than 2 Gb.
    But my system is Windows x64, MSVC x64 compilator and I use Qt Creator 4.10.1 that is based on Qt 5.13.1 compiled with MSVC x32.
    If I run:

    int data[2000][360000]; // 2.88 Gb
    

    I get an error like:
    C1126: automatic memory allocation exceeds 2G
    Is that beacause my Qt is compiled with x32 compilator?

    JKSHJ 1 Reply Last reply
    0
    • Please_Help_me_DP Please_Help_me_D

      Hi all,
      I encountered a problem that bothers me. I know that on x32 bit system a program that were compiled with x32 compilator can't include variable of weight more than 2 Gb.
      But my system is Windows x64, MSVC x64 compilator and I use Qt Creator 4.10.1 that is based on Qt 5.13.1 compiled with MSVC x32.
      If I run:

      int data[2000][360000]; // 2.88 Gb
      

      I get an error like:
      C1126: automatic memory allocation exceeds 2G
      Is that beacause my Qt is compiled with x32 compilator?

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      @Please_Help_me_D said in Can't create variable of weigth more than 2 Gb:

      Is that beacause my Qt is compiled with x32 compilator?

      A 32-bit application cannot use more than 2 GB of memory, even if your operating system is 64-bit.

      int data[2000][360000]; // 2.88 Gb
      

      You cannot have 3 GB of data on your stack. Use the heap instead.

      See https://software.intel.com/en-us/articles/memory-limits-applications-windows/

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      Please_Help_me_DP 1 Reply Last reply
      9
      • JKSHJ JKSH

        @Please_Help_me_D said in Can't create variable of weigth more than 2 Gb:

        Is that beacause my Qt is compiled with x32 compilator?

        A 32-bit application cannot use more than 2 GB of memory, even if your operating system is 64-bit.

        int data[2000][360000]; // 2.88 Gb
        

        You cannot have 3 GB of data on your stack. Use the heap instead.

        See https://software.intel.com/en-us/articles/memory-limits-applications-windows/

        Please_Help_me_DP Offline
        Please_Help_me_DP Offline
        Please_Help_me_D
        wrote on last edited by
        #3

        @JKSH thank you!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved