# X64 and x32 FreeBSD, memory alocation intro application.



## Ira (Mar 25, 2016)

Hi, I have compiled a program for FreeBSD 10.2 32 bit. And I want to move that precompiled binary to AMD64 and run it. Why? I need much ram memory, I think I need more than 64 GB RAM memory.

My question is : 
If I compile an application for a i386 machine , how much memory can it handle? I want that app to use all 64 GB memory ram. That application to amd64? All memory?


Thanks. :d I hope you guys understand what I mean.


----------



## SirDice (Mar 25, 2016)

A 32 bit application can only address 4GB of memory, regardless of what the OS is capable off. For 32 bit you can use tricks like PAE but support for it isn't too good. The best way will be to build a 64 bit application to be able to use 64 GB.


----------



## zirias@ (Mar 25, 2016)

Ira said:


> Hi, I have compiled a program for FreeBSD 10.2 32 bit. And I want to move that precompiled binary to AMD64 and run it. Why?


Why indeed ... why not just compile it for amd64 then, which would be the obvious thing to do?



SirDice said:


> A 32 bit application can only address 4GB of memory, regardless of what the OS is capable off.


To be precise: A 32bit *process* on a byte-addressable machine like x86 can only address these 4GB. Applications needing more RAM on x86-32 typically use more than one process.



SirDice said:


> For 32 bit you can use tricks like PAE but support for it isn't too good.


In fact this wouldn't even help with the problem, as PAE is *physical* address extension, which means the whole machine can use more than 4GB RAM. It doesn't change anything about the size of a virtual address space (and so the amount of memory a single process can address).


----------

