Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-07-2018, 05:02 AM   #1
LQ Newbie
Registered: Dec 2018
Posts: 2

Rep: Reputation: Disabled
I am running out of virtual memory, but swap is not being used.

I am running out of virtual memory for compiling a large program even though I have a ton of swap space reserved. (9+ GB)
Latest Kickass Torrent Mirror Sites Free Netflix Cookies 2018 Latest 1337x Torrent Mirror Sites Best Dash Cam In Market
The following is output from many different commands various question/answer sites suggest:
> make -sj12
g++ ....
virtual memory exhausted: Cannot allocate memory

> watch -n1 free    #Run during make above, Swap used stays at 0.
	          total        used        free      shared  buff/cache   available
Mem:            15G        2.0G        7.8G         72M        5.8G         12G
Swap:          9.3G          0B        9.3G

> cat /proc/meminfo | grep "Mem\|Swap"
MemTotal:       16353744 kB
MemFree:         8004104 kB
MemAvailable:   13465512 kB
SwapCached:            0 kB
SwapTotal:       9720828 kB
SwapFree:        9720828 kB

> cat /proc/sys/vm/swappiness

> cat /etc/fstab  | grep swap
/dev/sdb2	none	swap	sw		0	0

> sudo fdisk -l | grep swap
/dev/sdb2  468750336 488191999  19441664   9.3G Linux swap

> vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 7464340 360036 5812144    0    0    14    38    2    3  3  1 97  0  0

> cat /proc/swaps
Filename          Type      Size    Used Priority
/dev/sdb2         partition	9720828 0    -1
Everything looks like it should be right to me. Am I missing something?

Last edited by sherloc987; 12-08-2018 at 04:54 AM.
Old 12-07-2018, 10:17 AM   #2
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 4,073

Rep: Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813
Bit of a guess here, but that sounds like a process that tried to grow beyond 4GB on a 32-bit machine. It's a limitation of the virtual address space, not physical memory.
Old 12-07-2018, 10:33 AM   #3
Senior Member
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 2,217

Rep: Reputation: 478Reputation: 478Reputation: 478Reputation: 478Reputation: 478
A process could try to allocate, say, 30GB of memory. This can fail on your system (I don’t know if and how memory can be “overbooked” on Linux). “Allocating memory” is just a bookkeeping task, i.e. the process asks the kernel to reserve that amount. No need to write anything to swap space.
Old 12-07-2018, 11:09 AM   #4
Registered: Aug 2002
Posts: 17,828

Rep: Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401
make -sj12
I think your trying to run to many processes in parallel which exceeds the amount of RAM. Hopefully others might have a definitive answer but as suggested use -j nproc+1.


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
Is base memory of virtual machine used when virtual machine is not running? ravisingh1 Linux - Virtualization and Cloud 3 04-09-2013 04:41 AM
Slow server with a lot of swap memory that is not being used souterni Linux - Kernel 4 05-18-2012 02:01 AM
Swap memory is not being used when needed mikeyt_333 Linux - General 13 01-12-2005 01:42 PM
Swap being used before memory gone bmiley_ncaa Linux - Hardware 2 09-29-2004 04:53 PM
swap space used: 0; memory used: 90-95% abs Slackware 9 08-30-2004 01:33 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:23 PM.

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