I hope this is the right forum. I have a C++ program that is relatively memory hungry but works fine and is stable under linux 64. When I try to run under Win32, I often get a failure of malloc (cannot allocate memory segment). I must admit that I allocate large blocks ( 50 MB) but, again, it works in Linux.
For practical reasons, I compiled the windows code in Win32 (because I have some 3rd party libraries compiled in that mode). So, I am wondering whether it is worth the trouble to compile all those 3rd libraries in x64 and my code as well in hope to get a better behavior from malloc() .
Note that I tried to use new/free and I got the same problem ( cannot allocate memory). Anybody knows if malloc will be more likely to behave if I compile all my code in 64 bit ? Any comments is welcome.
Thanks in advance!
In Windows 32-bit, the default maximum user program+data+stack size is 2GB (the other 2GB of virtual address is reserved for system). You can increase this to 3GB. See: http://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/How-to-...
Another hint, is to specify the stack size to only the maximum amount used. This will provide for the most space for your heap. Do not use "unlimited" this does not mean unlimited, rather it means give me a really big hunk of (the limited) address space.