Question about ever growing swap space on raspi 4 4 GB

Jan 24, 2020 61 Replies

On a sunny day (Mon, 27 Jan 2020 20:01:23 +0000) it happened druck wrote in :

OK, thnak you. Better avoid it getting full! Seems OK now:

Fri 24 Jan 2020 03:10:42 PM CET: MiB Mem : 3906.0 total, 2891.6 free, 378.2 used, 636.2 buff/cache MiB Swap: 100.0 total, 20.4 free, 79.6 used. 3378.8 avail Mem

Sat 25 Jan 2020 06:46:05 AM CET MiB Mem : 3906.0 total, 2653.7 free, 372.0 used, 880.4 buff/cache MiB Swap: 100.0 total, 24.7 free, 75.3 used. 3380.4 avail Mem

Sun 26 Jan 2020 07:32:08 AM CET MiB Mem : 3906.0 total, 3265.9 free, 370.6 used, 269.5 buff/cache MiB Swap: 100.0 total, 26.9 free, 73.1 used. 3383.9 avail Mem

Mon 27 Jan 2020 07:01:17 AM CET MiB Mem : 3906.0 total, 3364.9 free, 372.7 used, 168.4 buff/cache MiB Swap: 100.0 total, 28.7 free, 71.3 used. 3382.6 avail Mem

Tue 28 Jan 2020 04:40:45 AM CET iB Mem : 3906.0 total, 2881.9 free, 374.7 used, 649.5 buff/cache MiB Swap: 100.0 total, 29.5 free, 70.5 used. 3375.7 avail Mem

Getting better!

So I will leave it running this way, Do not fix it if it works!

For the other poster, as the system is just writing video to disk using a shorter cache (by writing it more often to harddisk) has no bad side affects, the stuff will have to be written to disk anyways. In fact the writing periods will be more often and shorter, but it is the same amount of data, Writing to disk more often causes less long interrupts and keeps more memory available.

In fact Linux caching results in a high video delay on some of my systems (PCs)!

20 seconds for mcamip is normal!

Also it is a security risk, in case of a power failure you lose the last (likely most important part where you see the bad guy cutting the cables) 20 seconds.

thats a serious error

?It is dangerous to be right in matters on which the established authorities are wrong.? ? Voltaire, The Age of Louis XIV

Nope malloc succeeds and processes get a SEGV when they try to map memory that can't be found.

That is the designed response to out of memory conditions on every flavour of unix I know, what else would you suggest ?

Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. | http://www.sohara.org/

I wouldn't. I am not saying the behaviour is wrong or inappropriate, just that it is in fact always pretty *serious*.

It is te last ditch attempt to prevent a system crashing altogether: and in most cases a hard reboot is a pragmatic option.

"Nature does not give up the winter because people dislike the cold." ? Confucius

Look at /etc/dphys-swapfile and man dphys-swapfile AFAIK it checks the swap file on startup. Not there => create; already there => check if size as requested.

Chris Elvidge, England

Fair enough, it is of course.

Yep.

Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. | http://www.sohara.org/

Not on all systems: neither the manpage nor /etc/dphys-swapfile exist on this Fedora system - but maybe thats because it has a swap partition.

Martin | martin at Gregorie | gregorie dot org

dphys-swapfile (as I said earlier) is a Raspbian (Debian/Ubuntu) artifact. I can't see why it should exist on Fedora (RedHat?).

Chris Elvidge, England

And it usually kills a process that is the last one you'd choose yourself ...

Not a huge problem as it tends to be pretty random reads and writes of page sized data. It wouldn't make much difference even with a swap partition, which would be a single continuous area.

That is the big problem with swap on flash, but its the pattern of random accesses rather than fragmentation of the file which gives such bad performance.

---druck

I missed the 'Debian-only' notice - sorry 'bout that.

Martin | martin at Gregorie | gregorie dot org

A prime example of Sod's Law.

-- Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. |

formatting link

Why is it that when something is lost its always in the last place you look?

?The ultimate result of shielding men from the effects of folly is to fill the world with fools.? Herbert Spencer

Because you stop looking when you find it of course.

Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. | http://www.sohara.org/

The question that nobody ever asks is:

"Why did yo start looking in the wrong place?".

Martin | martin at Gregorie | gregorie dot org

Leading question. The real question is 'why wasn't it IN the right place?

There?s a mighty big difference between good, sound reasons and reasons that sound good. Burton Hillis (William Vaughn, American columnist)

...probably both questions have the same answer.

Martin | martin at Gregorie | gregorie dot org

;-)

-michael - NadaNet 3.1 and AppleCrate II: http://michaeljmahon.com

I got me a 4B 4Gig, and bought me tiny 128 Gig USB plug, stuck it into the back, configured sufficient Swap space on it and added it to fstab.

Was going to hook one of my 1T SSD USB-3 drives in but when I compiled a reasonably large program with make -j4 I noticed it didn't even use any swap space at all :-)-O so I'll probably just leave the plug in.

el

[...]
if you want to reply, replace nospam with my initials

I had one of those, and tried it in the Pi, but it got alarmingly hot when in use. Instead I use a Samsung USB 3.1 bar drive, which is larger and made of metal, so dissipates any heat very quickly.

---druck

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required