Handmade Hero»Forums»Code
38 posts
x86 Build Fails to Alloc
So I guess this can go in that notebook of stuff to fix, but currently the x86 build instantly closes with a NOT_ENOUGH_MEMORY error in the main *Memory VirtualAlloc.

(Also worth noting is that our custom BaseAddress truncates to zero on 32-bit platforms)

I fixed it by dropping the transient memory size to 850MB. 900MB crashes.

We could just add the /largeaddressaware linker flag, but I don't think we should. Anyone actually using a 32-bit system would need to set a boot flag to make use of the extra space (which we for free by running a 64-bit OS).

We're only allocating a little over a gigabyte total, anyone know why that hits a 32-bit limit?
Mārtiņš Možeiko
2559 posts / 2 projects
x86 Build Fails to Alloc
Edited by Mārtiņš Možeiko on
Maybe you don't have enough memory available on your 32-bit machine? If you have only 2GB of memory and have pagefile disabled, then it is very possible that you can not allocate 1GB of memory on Windows 7.


(Also worth noting is that our custom BaseAddress truncates to zero on 32-bit platforms)
That is fine, because this is only for internal build. And internal build is done on 64-bit machine. When compiling final release binary BaseAddress will be set to 0, and OS will decide it for us.
38 posts
x86 Build Fails to Alloc
Edited by theinternetftw on Reason: messing with formatting to learn forum stuff
Maybe you don't have enough memory available on your 32-bit machine?

I'm running the 32-bit exe from 64-bit windows, I have 8GB of RAM, a 8GB page file, and I had 33% RAM usage when the build failed to alloc. So no.


That is fine, because this is only for internal build.

I know. But it's something to be aware of when debugging the 32-bit build.
Mārtiņš Možeiko
2559 posts / 2 projects
x86 Build Fails to Alloc
Hm, could it be that introducing DLL is giving this problem? Because DLL loads at randomized address it may be loading somewhere in middle of 2GB application address space in a way that doesn't leave 1GB contiguous free space (because exe is also loaded at random base address).
38 posts
x86 Build Fails to Alloc
It doesn't look like it. I rolled back to a pre-dll build, and tried with and without setting the BaseAddress (to 50MB and then 4MB, which I assume are safe on windows, but I'm no windows guy). Anyway, they all have the same problem.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
x86 Build Fails to Alloc
On 32-bit platforms I think it's unlikely that you will get 1gig continuous virtual address space because there's only 2gigs total of virtual address space. If you want to try to get 1 gig of memory on those platforms, we'd have to break up the allocations into smaller chunks, which is something we might do come ship time for greater compatibility, but which is definitely not something we want to do during development.

- Casey
26 posts
x86 Build Fails to Alloc
So there won't be any chance to develop the game in a 32bit environment? Asking because i like to develop ony my synced 32-bit tablet on the fly too.
Mārtiņš Možeiko
2559 posts / 2 projects
x86 Build Fails to Alloc
For now you could try allocating smaller size for TransientStorage. Try something like 256MB. Also disable fixed base address (use 0). This will work until Casey will start using more than 256Mb of transient storage.