1

I have read a few replies on stackexchange that using swap is actually bad on a pi since the HDD is on SD card. By default Raspbian comes with 100MB swap enabled. Should I disable swap altogether? Are there pros or cons to doing so?

1

Swap is only used if you run out of memory.

The Pi normally uses a swapfile, which if not used has no penalty, but if required is slow.

Without swap the OS will terminate low priority processes or crash. The choice is yours.

|improve this answer|||||
  • Typically if swap is enabled there is a threshold before pages are swapped out, this is controlled by kernel parameters.(swappiness among others). Because this behavior is dynamic there is some argument to disable swap to preserve the SD Card, on the other hand, it is less reasonable to increase the threshold to 100% because this will cause more thrashing than the default value as the OS tends to swap out cached files and unused code sections first, and you preclude pre-emptive swapping with a large swapiness value – crasic May 21 '18 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.