Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You cannot get stuff into swap without it being allocated in memory (RAM) and being evicted.
Check you don't have other users of RAM - /tmp for example. Make sure it isn't on a tmpfs (/dev/shm you can't do anything about).
I have the same problem now. (I'm including a huge file)
We know the swap space is used when the memory runs short while running.
but somehow gcc doesn't seems to use swap space when memory runs low.
(I can see it using free -m command while gcc is running, the used memory goes up and then gives me this
- virtual memory exhausted: Cannot allocate memory during.. error. The swap usage is 0 in the mean time..)
The original question is about how we make gcc use swap file. Does anyone have answer?
Chan
The gcc compiler is exactly like any other application program: it runs in virtual memory, as dictated by the Linux operating system. It therefore seems that Linux is running out of capacity to run the compiler on that board.
However, the usual practice is not to do that. As others have said, you "cross-compile" on a larger machine, then transfer the binary to the phone or what-have-you. Mobile devices ordinarily do not have sufficient resources to run their compilers directly ... and, you don't need to. The compiler, running on a host machine, generates object-code for the target that must run on the target. (And/Or in a simulator.)
Last edited by sundialsvcs; 06-20-2017 at 01:02 PM.
If you are close to amount you might get by with zram and swappiness set to 100.
Strip down your system to the bare amount of current OS needed to compile.
Maybe set ulimit.
Suppose an ultra fast ssd could possibly help timings for swap issues.
Change how the compiler is doing work.
Without changing how a program works it is usually hard to change how ram is used. Ram is ram as they say.
The computer will use the swap space when all the RAM is taken up. I don't think there's any way to specify that any specific program uses swap instead of RAM.
I suspect that this box simply does not have the resources needed, swap or no swap, and it appears to be exhausting the swap space that it has. The box simply isn't big enough to do the job ... but, it doesn't have to.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.