Author Topic: Is it possible to expand the heap dedicated to my program?  (Read 3124 times)

Adriano

  • Guest
Is it possible to expand the heap dedicated to my program?
« 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?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Is it possible to expand the heap dedicated to my program?
« Reply #1 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).
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Is it possible to expand the heap dedicated to my program?
« Reply #2 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 (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.