On large maps it will crash randomly?

Well, before the update that Garry’s mod won’t work, I had a random problem. Sometimes when playing on large maps like Rp_Apocalypse, my game would crash randomly, I’d leave the room for a little while and when I came back the game would have crashed and HL2.Exe would stop working, does anyone know a solution?