LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 07-12-2011, 09:02 PM   #1
Jeff91
Bodhi Developer
 
Registered: Jan 2009
Location: Bloomington, IL
Distribution: Bodhi
Posts: 309

Rep: Reputation: 33
Have GCC use SWAP instead of/with RAM


I'm trying to build firefox mobile (fennec) on a device that only has 256meg of RAM and it is failing out due to lack of RAM errors.

Is there a way I can force the GCC compiler to use SWAP space when compiling instead of RAM? I've got a fairly large swap file.

~Jeff
 
Old 07-12-2011, 09:29 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,715

Rep: Reputation: 2120Reputation: 2120Reputation: 2120Reputation: 2120Reputation: 2120Reputation: 2120Reputation: 2120Reputation: 2120Reputation: 2120Reputation: 2120Reputation: 2120
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).
 
Old 07-13-2011, 12:16 AM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Alternatively consider cross-compiling on your big-rig.
 
Old 06-14-2017, 11:42 PM   #4
flyxtop
LQ Newbie
 
Registered: Apr 2013
Posts: 11

Rep: Reputation: Disabled
how to set gcc to use swap file?

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
 
Old 06-20-2017, 01:01 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,316
Blog Entries: 4

Rep: Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831
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.
 
Old 06-20-2017, 03:12 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,652

Rep: Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445
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.

Last edited by jefro; 06-20-2017 at 03:17 PM.
 
Old 06-20-2017, 03:41 PM   #7
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 142Reputation: 142
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.
 
Old 06-20-2017, 04:03 PM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,316
Blog Entries: 4

Rep: Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831Reputation: 2831
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.
 
  


Reply

Tags
fennec, firefox, gcc


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why Swap=2 x RAM diptanjan Linux - Newbie 15 07-19-2007 02:18 AM
Why using swap when RAM is available? MasterOfTheWind Linux - General 3 10-06-2006 12:45 PM
When SWAP and RAM are out syberdave Linux - General 6 01-07-2006 12:13 AM
RAM and Swap shiny_spoon Linux - General 5 01-13-2004 02:27 PM
No SWAP but all RAM!! hari_seldon99 Linux - General 3 01-13-2004 10:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration