
| From: mwilson--- via talk <talk@gtalug.org> | My main desktop is a Raspberry Pi 4B+ with 8GiB. Neat! | `top` says that swap is full (100MiB), but there's 1.2 GiB of memory | available. I'd be tempted to add swap. But then again, if that is on an SD card, maybe not. I don't know the kernel policies. Or rather, I know a lot of different kernels' policies. So this will be unreliable. 1. Paging policies tend to migrate pages that haven't been used recently, but must be preserved, to swap. Code pages don't need to be written to swap because they are immutable -- they can be reloaded from the original file. 2. If there is no memory pressure (i.e. more RAM than things to occupy it), probably nothing goes to swap. 3. It used to be that RAM was used for processes: code and data. For a few decades, files have been allowed to fill up available RAM but could be easily evicted to their place in the filesystem when memory pressure got high. Eviction often requires no I/O: if the file was only being read. Consequence: RAM may all be used but since things can be evicted there is room for more stuff: you haven't run out. 4. In the last couple of years a new level of swap has been created: compressed swap stored in a RAM-disk. This sounds crazy but makes sense if the stuff being swapped is significantly compressable. And if writing to swap is slow (eg. SD card) So: Your swap being full may mean that some stuff is stranded in RAM even though it isn't used much. Your RAM having 1.2 GiB available does not actually indicate that RAM is tight. Much of the occupied space might be evictable files. If you were truly short of RAM + swap, I think you would see OOM messages in the log. | GIMP that came with Raspberry Pi OS is not wonderfully stable -- might | crash once a day on average. Doesn't seem directly due to memory shortage | though. Console messages from one time that I ran it from the command | line hinted that there might be mutual exclusion problems with GtK, or | something. Are you running it from GDB? In theory that might help you figure out what's going on. But GDB would like to to install the symbols for executables that you care about and that may overwhelm your SD card.