My application is 32-bit but runs out of heap space after only 2GB. What is the problem?

On our SUN systems, you can set limits on the stack space and heap space using the limit command: The above example sets the maximum stack space to be 0.5 GB. You can also "unlimit" the stack space with: You can also "unlimit" the heap space: Since SUN Solaris 2.8 is 64-bit, you can have a swap space file greater than 2 GB, and can therefore have a heap space of more than 2 GB. However, if you unlimit the stack space, it will set it to 2 GB, meaning that the remaining space in a 32-bit address for the heap space is 2 GB. To give more space to your heap for a 32-bit application, limit your stack. With a stack size of 1 GB, my heap space could grow to 3 GB. This allowed me to use the 32-bit compilation of Polaris without attempting to compile with the 64-bit gcc compilers.