Code::Blocks

User forums => Using Code::Blocks => Topic started by: Adriano on September 03, 2019, 12:30:31 am

Title: Is it possible to expand the heap dedicated to my program?
Post by: Adriano on September 03, 2019, 12:30:31 am
Hi, I have to work with huge data (in ther orther of billions int numbers) and I'm not able to dynamically allocate the arrays because it lacks memory. Is it possible to expand the heap using Code::Blocks (running on Win 8.1)? Case it is possible, how can I do that?
Title: Re: Is it possible to expand the heap dedicated to my program?
Post by: oBFusCATed on September 03, 2019, 12:38:44 am
What mode are you building your app 32bit or 64bit? 32 bit apps are limited to 2gb or (3.5 in some special settings).
Title: Re: Is it possible to expand the heap dedicated to my program?
Post by: sodev on September 03, 2019, 01:40:55 am
If you are using a 64 bit OS even a 32 bit application can use the full 4 GB address range if you mark it as Large-Address-Aware https://docs.microsoft.com/en-us/cpp/build/reference/largeaddressaware-handle-large-addresses?view=vs-2019 (https://docs.microsoft.com/en-us/cpp/build/reference/largeaddressaware-handle-large-addresses?view=vs-2019) (GCC also offers a switch for that). If thats not enough you have to compile your application in 64 bit to use all available RAM. And if you don't have enough RAM, you can't process your data in one chunk but have to divide it into smaller chunks.