Monday, May 24, 2010

How to make compiler use swap space in solaris? It is only using physical memory.?

The Solaris 8 machine is having 2GB of physical memory and 6 GB of swap space. However, the C++ compiler (Sun ONE Studio) is not using the swap space. It uses only physical memory. When the compilation requires nearly 3GB (due to exe size), it ends up throwing memory error instead of using the swap space. What is forcing Solaris not to use the swap space while compilation? What options can be enable to make it use swap space?

How to make compiler use swap space in solaris? It is only using physical memory.?
You've misdiagnosed the problem; it is not an issue of


the compiler "not using swap". Do note, also, that any


32-bit process can *never* exceed 4GB since that's


the theoretical upper bound of the address range (2^32).





I don't know why the compilation stops at 3GB, but even


that is a lot bigger than you'd normally see. Are you sure


it's actually growing that big? Use "/bin/prstat" to watch


the SIZE field for each sub-process in the compilation.


For a long-running process, you can look "inside" it


using "/bin/pmap -x PID" (where PID is the process ID


of the process you're looking at). I just realized that


if you're running out of heap space, it *could* be because


your "stack" user limit is big (ie. 1GB). Check with


"ulimit s" (for ksh/bash/sh) or "limit stack" for (csh/tcsh).


It *should* be something reasonably small like 8192 KB.


If it is large (ie. 1000000 KB), then reduce it down so that


the heap has room to grow.





The thing is, 3GB is *huge* for a compilation. You


might consider turning off the debug option for some


of the files to see if that helps. Alternatively, it's


possible that you've hit some bug in a phase of


the compiler (ie. the optimizer) which grows too


large on the particular source you've given it. You


might consider dropping the optimization level on


that particular module to see if you dodge the problem.





Also, if you're linking with other software, you're right that


you can't switch away from the Sun compilers because


Sun and GNU use different ABI's for C++. However,


you very well might be able to upgrade to a current


release of the Sun compilers because they maintain


backward compatibility. Version 8 is *many*


years old, and the new compilers are not only


improved (faster, better code, bugs fixed), but you


can use them for free (and you don't have to mess with


licensing). See:


http://developers.sun.com/sunstudio/down...





If you really go on an upgrade binge, the same


can be said for using Solaris 8 vs. Solaris 10.


Keep in mind that Solaris 10 is open source and


you can use it for free.





Finally, if you need help with the Sun compilers, you


should go to the Sun help forum. YA is great, but the


Sun tool forum does *nothing* but answer questions


about the Sun compilers/debugger/analyzer. That level


of specialization is tough to beat for a specialized


question. See:


http://forum.java.sun.com/index.jspa?tab...
Reply:Try using g++ instead of the Sun compiler.


Is this a 32-bit or a 64-bit system? Is the CPU a Sparc, x86 or x86-64?


No comments:

Post a Comment