# was killed: out of swap space - HUH?



## userxbw (Aug 17, 2019)

so I was typing along in geny working on a script, while I was running it in the term to check it, then went back to  geany. It was gone! 

I just reopened it and went on working on it again. then aftrer I finished my script I added it to the start up for xfce,  logged out, to login again to run the script then I seen this in the terminal. 


```
swap_pager_getswapspace(20): failed
swap_pager_getswapspace(32): failed
swap_pager_getswapspace(20): failed
swap_pager_getswapspace(32): failed
swap_pager_getswapspace(20): failed
swap_pager_getswapspace(32): failed
swap_pager_getswapspace(32): failed
pid 1776 (firefox), uid 1000, was killed: out of swap space
pid 88916 (firefox), uid 1000, was killed: out of swap space
pid 88293 (firefox), uid 1000, was killed: out of swap space
pid 88011 (firefox), uid 1000, was killed: out of swap space
pid 18752 (geany), uid 1000, was killed: out of swap space
```

I checked my swap I got 4GB's it is only using 24MB .
I got 8GB RAM.

I seen this








						Why "out of swap space", when I don't have any?
					

Hello =)  I have 32 GB RAM on my FreeBSD 9.2-PRERELEASE storage hosts and no swap space. I don't have any memory expensive tasks running like de-duplication, but I get a SSH and other daemons are being killed now and then.  Sep  1 04:50:04 example kernel: pid 99217 (ssh), uid 0, was killed...




					forums.freebsd.org
				



it says to add a swapfile? why I got plenty of swap partition, and I do not even know if that is a real fix. a strange fix that would be. I am perplexed as what else to put on this issue.


----------



## gpw928 (Aug 18, 2019)

Hi,

In the absence of any other compelling information, I would believe the log.  i.e. your swap space requirement exceeded 4 GB.  Firefox can be a bit of a pig.

Try adding more swap space, or a swap file if that's more convenient.


----------



## Beastie (Aug 18, 2019)

Something got out of control; probably those 4 Firefox processes. And the system started its killing spree. I'm not saying for sure Firefox is the culprit here but it's a very good candidate. It has become such a beast in the past couple of years, but I think 8GB should be sufficient. Do you have many extension? Perhaps Facebook constantly updating? Is it up to date (maybe it's got a memory leak)?



userxbw said:


> I checked my swap I got 4GB's it is only using 24MB .


That was after logging out of Xfce? Well then, after logging out a DE and after having killed all those processes, the system must have freed most of the swap as well as a lot of memory.


----------



## drhowarddrfine (Aug 19, 2019)

gpw928 said:


> Firefox can be a bit of a pig.


Firefox only requests memory. It does not control how much it receives and if the operating system gives it too much that is not Firefox's fault. In addition, Firefox will request more available memory when it helps improve performance because...it's available memory...but it returns it quickly.


----------



## badbrain (Aug 21, 2019)

drhowarddrfine said:


> Firefox only requests memory. It does not control how much it receives and if the operating system gives it too much that is not Firefox's fault. In addition, Firefox will request more available memory when it helps improve performance because...it's available memory...but it returns it quickly.


Does this also mean FreeBSD sucks at memory management?


----------



## SirDice (Aug 21, 2019)

badbrain I strongly urge you to take your negativity elsewhere.


----------



## olli@ (Aug 21, 2019)

drhowarddrfine said:


> Firefox only requests memory. It does not control how much it receives and if the operating system gives it too much that is not Firefox's fault.


That's not how it works. If an application requests a certain amount of memory, the operating system will give it exactly that much memory, no more, no less (except for small pieces that may be required for alignment or management purposes).

I agree with qpw928 – Firefox doesn't exactly try hard not to waste memory. When I open the same number of tabs with the same websites in Firefox, Chrome and Opera (fresh installs without extensions), Firefox takes the largest amount of memory (looking at the RSS, not at the virtual size). Installing extensions makes things even worse.


----------



## drhowarddrfine (Aug 21, 2019)

badbrain said:


> Does this also mean FreeBSD sucks at memory management?


No. It only shows you don't know what you're talking about.


----------



## drhowarddrfine (Aug 21, 2019)

olli@ Well, yes, that is what I'm saying. The application, Firefox, requests the memory and the operating system gives it but the operating system will not give it memory it does not have to give.


----------



## PMc (Aug 22, 2019)

The first error is `swap_pager_getswapspace(20): failed`
The pager was requested to aquire 20 pages (should be 80kB), and that failed.
The question is not what firefox might do nor might not do. The question is: why did that fail?
I might suppose there could be something wrong with the swap device.


----------



## olli@ (Aug 23, 2019)

PMc said:


> The first error is `swap_pager_getswapspace(20): failed`
> The pager was requested to aquire 20 pages (should be 80kB), and that failed.
> The question is not what firefox might do nor might not do. The question is: why did that fail?


Well, it failed because swap was full. 4 GB isn't really that much. If some dynamic website gets out of control, Firefox can grow to considerable size.

Apart from adding more swap space, the OP could try to configure process limits (see limits(1)) or resource limits (see rctl(8)).
Also, make sure that the sysctls `vm.overcommit` and `vm.swap_idle_enabled` are both set to 0 (should be the default).


----------

