My RPi3 with Retropie 3.6, and PS3 controllers over Bluetooth, has had random and not random freezing since the start. Could basically occur anytime, for example when transferring files over LAN, using the scraper, playing games. Always pretty random but not far between. Memory split change did not cure it, neither updating various files. Notably, I could reproduce the freeze every time I started Game&Watch – Nintendo Donkey Kong with the controller connected by USB cable, then removing the cable in game.
The solution was this: (I have not had any freezing since, ran a total 2 h on Dreamcast, Ps1, SNES, NES, game&watch and more. Even the Emulator station scraper worked tagged some 200 C64 games in a row)
1. Exit Emulator station
2. At the command prompt:
sudo nano /boot/config.txt
add to the file in the editor:
dtoverlay=pi3-disable-bt
3. Exit editor (ctrl x, Y, return)
4. Then run from the command prompt:
sudo systemctl disable hciuart
Remember: make a backup before not to risk your setup.
(previously tested to only do 1-3 but that did nothing)
Hope this helps, seem many are affected by this issue.
Edit: Forgot to say I now run Bluetooth via dongle, needed to pair the controllers again to get started.