I would suggest moving to 8GB, 4GB just doesn’t cut it and without tuning which won’t do that much, it’s worth more hassle than just having a machine with 8GB. Even after tuning (I tried), it will use 3.5GB and swap, which means your VM runs slow, susceptible to OOM killer, which is what you are experiencing when Gitlab dies. What @dnsmichi wrote pretty much hits the nail on the head.