How to use VSCODE remote debuging on a raspberry pi 3 without OS crashes

You will often encounter OS crashes when using VSCODE on a rpi3 for debugging. The cause: memory overflow and too low swap size. If you set the swap memory to 1024MB you will have solved the problem.

Follow these steps (source https://nebl.io/neblio-university/enabling-increasing-raspberry-pi-swap/) ->

1. Temporarily Stop Swap:

sudo dphys-swapfile swapoff

2. Modify the size of the swap

As root, edit the file /etc/dphys-swapfile and modify the variable CONF_SWAPSIZE to 1024:

CONF_SWAPSIZE=1024

Using a command such as:

sudo nano /etc/dphys-swapfile

3. Initialize Swap File

sudo dphys-swapfile setup

4. Start Swap

sudo dphys-swapfile swapo