Minecraft freezes after a while in background

I have a OBS setup for Minecraft speedrunning, whenever I have to adjust my OBS settings and leave Minecraft in the background for a while (1min is enough), I go back and find it freezes, having to force close it each time is so frustrating.

I use Nitro Launcher (CLI edition), I thought it might be a high RAM usage issue, but whether I give Minecraft 2GB/4GB/6GB/8GB of RAM, the problem is as always.

  Host: EStation Kernel: 6.17.9-arch1-1 arch: x86_64 bits: 64
  Desktop: KDE Plasma v: 6.5.3 Distro: EndeavourOS
CPU:
  Info: 16-core (8-mt/8-st) 12th Gen Intel Core i7-12850HX [MST AMCP]
    speed (MHz): avg: 800 min/max: 800/4700:4800:3400
Graphics:
  Device-1: NVIDIA AD107M [GeForce RTX 4060 Max-Q / Mobile] driver: nvidia
    v: 580.105.08
  Device-2: Chicony HD Webcam driver: uvcvideo type: USB
  Display: unspecified server: X.Org v: 21.1.20 with: Xwayland v: 24.1.9
    driver: X: loaded: nvidia unloaded: modesetting gpu: nvidia,nvidia-nvswitch
    resolution: 1: N/A 2: N/A
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 580.105.08
    renderer: NVIDIA GeForce RTX 4060 Laptop GPU/PCIe/SSE2
  Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo
    de: kscreen-console,kscreen-doctor gpu: nvidia-settings,nvidia-smi
    wl: wayland-info x11: xdpyinfo, xprop, xrandr
Drives:
  Local Storage: total: 476.94 GiB used: 128.78 GiB (27.0%)
Info:
  Memory: total: 16 GiB note: est. available: 15.35 GiB used: 5.63 GiB (36.7%)
  Processes: 442 Uptime: 2h 43m Shell: Sudo inxi: 3.3.39

Try opening the launcher with then ENV set command line
MESA_LOADER_DRIVER_OVERRIDE=zink

Hi AceFour,
Thank you for replying! I tried the ENV but was confused, so I looked online and found how to force use zink, but after more research afaik you can’t force OpenGL backend on a proprietary NVIDIA driver, so mesa/zink is incompatible? Correct me if I’m wrong I was so confused.
Best Regards

Ahh, didn’t realize you had Nvidia