How do I fix memory leaks when streaming casino games live?

Hello all, we have a livestream of a casino game on our website and wiki, but the memory leak is crashing the stream. Does anyone know what to do? We’re trying to use unity to create the simulated game and OBS to stream it. How can we avoid/stop memory leaks and keep our streams up without issues? Thanks!

2 Answers

AnalyticsOverlay
AnalyticsOverlayAnswered on 12/22
Best Answer

Memory leaks are annoying when playing casino games. Based on your Unity/OBS setup, I would first look into improving your Unity project. Are you removing GameObjects? Do you need to instantiate hundreds of GameObjects per frame for the animation or special effect?

For OBS, consider trying to reduce your output bitrate (you may be going a bit too high). And check your capture settings. Game Capture is often more efficient than Screen Recording.

Maybe you should also install a memory profiler in Unity so you can see where leaks are accumulating.

If the leak occurs right after certain events during gameplay (such as huge payouts or state changes), then it’s probably related to something in that particular scene. Isolate those sections and see if you can optimize them.

Finally, make sure that Unity and OBS are up to date – they may have patches for performance issues. And always test heavily before broadcasting.

ToxicityAnalysis
ToxicityAnalysisAnswered on 12/22

Most memory leaks in a streaming session will occur within Unity or OBS itself. In Unity, destroy all unnecessary objects and textures each frame, and employ an object pooling system instead of spawning new objects on the fly. In OBS, reduce resolution on the preview screen if you don’t need it, and always ensure you are running the latest version of both OBS and Unity. Lastly, try restarting OBS as often as possible (every 6-8 hours) to reset its memory usage. If the leakage continues, check the Unity Profiler and the OBS System Monitor to find out which components are responsible, then disable these processes.

Your Answer