What is the Stack and Heap size of my Qt/C++ project?
-
@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:) -
@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:) -
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(); }
-
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(); }
@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:) -
@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:) -
@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:)@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
-
@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