Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. What is the Stack and Heap size of my Qt/C++ project?
QtWS25 Last Chance

What is the Stack and Heap size of my Qt/C++ project?

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 3 Posters 3.9k Views
  • 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.
  • M Mucip
    2 Aug 2018, 09:58

    @VRonin said in What is the Stack and Heap size of my Qt/C++ project?:

    #include <windows.h>

    Hi,
    Where is windows.h?! QT could not find it?...
    Regards,
    Mucip:)

    V Offline
    V Offline
    VRonin
    wrote on 2 Aug 2018, 10:01 last edited by
    #4

    @Mucip said in What is the Stack and Heap size of my Qt/C++ project?:

    Where is windows.h?!

    Should be part of the windows compiler. What are you using?

    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
    ~Napoleon Bonaparte

    On a crusade to banish setIndexWidget() from the holy land of Qt

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mucip
      wrote on 2 Aug 2018, 10:04 last edited by
      #5

      @VRonin said in What is the Stack and Heap size of my Qt/C++ project?:

      Should be part of the windows compiler. What are you using?

      Hi,
      Win10 , QT Creator 4.7.0, QT 5.11.1 (MSVC 2015, 32 bit)

      Regards,
      Mucip:)

      J 1 Reply Last reply 2 Aug 2018, 10:07
      0
      • M Mucip
        2 Aug 2018, 10:04

        @VRonin said in What is the Stack and Heap size of my Qt/C++ project?:

        Should be part of the windows compiler. What are you using?

        Hi,
        Win10 , QT Creator 4.7.0, QT 5.11.1 (MSVC 2015, 32 bit)

        Regards,
        Mucip:)

        J Offline
        J Offline
        JonB
        wrote on 2 Aug 2018, 10:07 last edited by JonB 8 Feb 2018, 10:08
        #6

        @Mucip
        You're in a severe mess if your MSVC doesn't have/find windows.h!

        M 2 Replies Last reply 2 Aug 2018, 10:13
        1
        • V Offline
          V Offline
          VRonin
          wrote on 2 Aug 2018, 10:07 last edited by VRonin 8 Feb 2018, 10:08
          #7

          Working example compiled with MSVC: http://rextester.com/HCD11597

          #include <iostream>
          #include <windows.h>
          #include <psapi.h>
          double getUsedMemoryMB()
          {
              PROCESS_MEMORY_COUNTERS pmc;
              GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
              return static_cast<double>(pmc.WorkingSetSize) / static_cast<double>(1024 * 1024);
          }
          int main()
          {
              std::cout << getUsedMemoryMB();
          }
          

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          M 1 Reply Last reply 2 Aug 2018, 10:43
          7
          • J JonB
            2 Aug 2018, 10:07

            @Mucip
            You're in a severe mess if your MSVC doesn't have/find windows.h!

            M Offline
            M Offline
            Mucip
            wrote on 2 Aug 2018, 10:13 last edited by
            #8

            @JonB said in What is the Stack and Heap size of my Qt/C++ project?:

            You're in a severe mess if your MSVC doesn't have/find windows.h!

            Hi,
            I guess so...
            Shoul I install win 10 SDK???

            Regards,
            Mucip:)

            1 Reply Last reply
            0
            • J JonB
              2 Aug 2018, 10:07

              @Mucip
              You're in a severe mess if your MSVC doesn't have/find windows.h!

              M Offline
              M Offline
              Mucip
              wrote on 2 Aug 2018, 10:35 last edited by
              #9

              @JonB said in What is the Stack and Heap size of my Qt/C++ project?:

              You're in a severe mess if your MSVC doesn't have/find windows.h!

              Hi,
              My situaiton like below...

              0_1533206136131_4201cd15-61c9-4fde-9718-bea9451fa75b-resim.png

              Regards,
              Mucip:)

              1 Reply Last reply
              0
              • V VRonin
                2 Aug 2018, 10:07

                Working example compiled with MSVC: http://rextester.com/HCD11597

                #include <iostream>
                #include <windows.h>
                #include <psapi.h>
                double getUsedMemoryMB()
                {
                    PROCESS_MEMORY_COUNTERS pmc;
                    GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
                    return static_cast<double>(pmc.WorkingSetSize) / static_cast<double>(1024 * 1024);
                }
                int main()
                {
                    std::cout << getUsedMemoryMB();
                }
                
                M Offline
                M Offline
                Mucip
                wrote on 2 Aug 2018, 10:43 last edited by Mucip 8 Feb 2018, 10:54
                #10

                @VRonin said in What is the Stack and Heap size of my Qt/C++ project?:

                #include <psapi.h>

                Hi,
                Finally I got it... Calital letter problem. It must be:

                #include "Windows.h"
                #include "Psapi.h"

                Is returning number STACK or HEAP?... And what is the limit?...

                Regards,
                Mucip:)

                J V 2 Replies Last reply 2 Aug 2018, 10:46
                1
                • M Mucip
                  2 Aug 2018, 10:43

                  @VRonin said in What is the Stack and Heap size of my Qt/C++ project?:

                  #include <psapi.h>

                  Hi,
                  Finally I got it... Calital letter problem. It must be:

                  #include "Windows.h"
                  #include "Psapi.h"

                  Is returning number STACK or HEAP?... And what is the limit?...

                  Regards,
                  Mucip:)

                  J Offline
                  J Offline
                  JonB
                  wrote on 2 Aug 2018, 10:46 last edited by
                  #11

                  @Mucip Windows filing system is case-insensitive, so no idea why you say you require capitals.

                  1 Reply Last reply
                  3
                  • M Mucip
                    2 Aug 2018, 10:43

                    @VRonin said in What is the Stack and Heap size of my Qt/C++ project?:

                    #include <psapi.h>

                    Hi,
                    Finally I got it... Calital letter problem. It must be:

                    #include "Windows.h"
                    #include "Psapi.h"

                    Is returning number STACK or HEAP?... And what is the limit?...

                    Regards,
                    Mucip:)

                    V Offline
                    V Offline
                    VRonin
                    wrote on 2 Aug 2018, 11:54 last edited by
                    #12

                    @Mucip said in What is the Stack and Heap size of my Qt/C++ project?:

                    Is returning number STACK or HEAP?

                    It's the sum of both

                    And what is the limit?

                    for 64bit systems the limit is just the hardware (how much RAM you have) for 32bit systems is the lower of the hardware memory and 4GB

                    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                    ~Napoleon Bonaparte

                    On a crusade to banish setIndexWidget() from the holy land of Qt

                    M 1 Reply Last reply 2 Aug 2018, 11:59
                    1
                    • V VRonin
                      2 Aug 2018, 11:54

                      @Mucip said in What is the Stack and Heap size of my Qt/C++ project?:

                      Is returning number STACK or HEAP?

                      It's the sum of both

                      And what is the limit?

                      for 64bit systems the limit is just the hardware (how much RAM you have) for 32bit systems is the lower of the hardware memory and 4GB

                      M Offline
                      M Offline
                      Mucip
                      wrote on 2 Aug 2018, 11:59 last edited by
                      #13

                      Dear @VRonin
                      Well, what about the 64K STACK limit I remember from old times?...

                      Regards,
                      Mucip:)

                      1 Reply Last reply
                      0

                      13/13

                      2 Aug 2018, 11:59

                      • Login

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