I have to compile a computer generated source with my sources which is too huge and I've no control over it. Since my memory is not much, I've to force make use less memory. Otherwise, it gets killed by OS (precise). What can I do?
I have to compile a computer generated source with my sources which is too huge and I've no control over it. Since my memory is not much, I've to force make use less memory. Otherwise, it gets killed by OS (precise). What can I do?
How about adding more swap to your machine as a solution? This will add more virtual memory and may allow you to build your code without the OOM killer killing the compiler. If you don't want to fiddle around with making your swap partition larger your could add a temporary swap file. For example, adding a file based 4GB swap:
Have you tried using
nice
? It allows to set a custom priority for your processes.nice
ranges from -20 to 19, being 19 the lowest priority and -20 the highest. You could try something like this:Example:
Edit: ellaborating a bit on my response, if your OS kills your process it's because is using resources that are needed for the correct functioning of your system. If you give your process a lower priority, those resources will automatically be allocated to more important system tasks.