EDIT 2
While it didn't answer my original question, since increasing the swap to 4G I don't experience any more computer freezes, so I accepted the answer
EDIT
As @heyynema suggested, I ran the following operations
I'll report back in a few days whether this has solved/improved the issue
OP
I'm running multiple dev related processes on my machine in the background, i.e. vscode, dev servers, etc
every once in a while my laptop kinda freezes almost entirely for about 30 seconds, and then everything goes back to normal.
during the "freeze" if I move my mouse I can see the cursor moving around very slowly with a huge lag.
Is there a way to identify which process is causing this?
I don't know much about memory and monitoring, is there an alert I should set up, i.e. "if any process exceeds X memory then log Y"?