0

How can I compile a 32-bit app on a 64-bit system with the LARGE_ADRESS_AWARE flag using Codeblocks? I need to use more memory than 2GB.

jogojapan
  • 68,383
  • 11
  • 101
  • 131
Skides
  • 295
  • 1
  • 5
  • 14

1 Answers1

3

Should be a case of adding -Wl,--large-address-aware to the linking flags. I don't use CodeBlocks, so can't tell you how you do that step by step, but I'm sure there is a "Linking Options" component in your project settings that you can add this string into.

The Linker options: http://sourceware.org/binutils/docs-2.17/ld/Options.html

Edit: Of course, if you have a modern enough gcc-mingw on your system, you should be able to give it -m64 for the compile and link stages, and get a native 64-bit app, at which point you can use as much memory as you like (well, until you exhaust either swap space or 48 bits of address range, whichever comes first - probably swap space - unless you have more than 256TB of disk-space...)

Mats Petersson
  • 126,704
  • 14
  • 140
  • 227
  • It is still using SWAP, when it reach the 2GB (1,3GB on VRAM, 800 mb on RAM) and need some more. Actual memory usage: 1,3GB on VRAM, 0,8GB on RAM, 0,8GM on SWAP, Free memory(ram) 1.500GB... – Skides Dec 26 '12 at 16:51
  • 1
    That's something else - probably windows being daft as usual. Swapping has nothing to `LARGE_ADDRESS_AWARE`. To prove that, try to write a piece of code that just allocates a lot of memory - say chunks of 100MB, and see how many you can allocate with and without `LARGE_ADDRESS_AWARE` (you can also check that it actually WORKS by writing to a byte every 1M or so in each block - you don't want to fill the whole thing, as it will take several seconds to fill a couple of GB of ram, even if it's NOT swapping). Unfortunately, I don't know of a "don't be daft with me" flag... Use linux? – Mats Petersson Dec 26 '12 at 16:56