Game crashes out of GPU memory

My game is frequently crashing if I try and launch 3 instances of it at once. I have to do this for multiplayer networking development to test on a server and 2 clients. It crashes because I run out of GPU memory, I have a GTX 1080 with 8GB of RAM on it, and according to Task Manager I have 16GB of Shared GPU memory. However, the shared memory seems to never be used, and I crash as soon as the dedicated memory goes over 8GB. Any ideas on how I can resolve this?

What does the Unity Profiler window tell you?

Here’s a screenshot of my rendering profile.

The odd thing is that there’s people with a 2gb GPU memory card that can run my game. By that logic I should be able to run at least four instances of the game before I’m out of GPU memory, but I can only run two.

Okay. I noticed that:
Alot of the DrawCalls + Batched Drawcalls, have high numbers.

Especially:
(Instancing) Batched Draw Calls: 136986

136986? Wow! Is that supposed to be so high?
That might be, one of the main culprits, that’s causing the problems.

2 Likes

I’m not sure if it is supposed to be that high or not. We have tons of trees, grass, and Ultimate Water System in the scene.

Lots of trees and grass? Okay.
So I’m guessing that your game, is some sort of mmorpg, or a multiplayer online adventure game? Because I saw you mention networking above.

It’s a multiplayer fantasy survival game.

Okay. Thanks for that info.

Normally, the problems you’re experiencing happens, if you have too many,
or a high number of Batches and DrawCalls. And sometimes, if you have a
super large number of enemies, or items, made up of ridiculously high polycounts
on screen, it could cause your game to crash, even if you have a powerful graphics card, and alot of RAM. Worse, if you’re playing online.

This is where texture atlases and batching objects come in.
As doing so, will help optimise and reduce drawcalls, making your game run
smoother, with a high frame rate, whether it be online, or offline.
But I am sure, that you know about that info already.

And I figure, that you’re making your game, for high end PC’s and devices.
And sometimes, these same problems can occur, if the game, is not
optimised enough.

But since I am not, a super expert on networking, I sent a message to
another Unity user called Bgolus, and a Unity team member, who might be
able to help you. Hopefully they could help figure out, what is causing this
strange problem you’re experiencing. Since I have a suspicion, that there
could be something else, that is adding to the cause this problem.

1 Like

Thank you. And yeah, I know we still have lots of optimizations that need to be done on the graphics side of things. I’m just at a loss for why my computer uses more GPU memory to load the game versus other peoples.

It sounds like you have just dumped all the trees grass etc into the scene and hoped it would run okay? Can you list what optimizations you have performed so we can determine what is left to suggest to try and bring the GPU utilization down?

100% an open world game will need many optimizations both GPU and CPU to run well. 136986 batched draw calls is quite a lot and could mean batching is not working.

GPU instancing should not be used with dynamic batching, are you perhaps trying to use both?

How have you assigned materials, is it one material per model, or one material per sub mesh of model? Things like this will affect this.

Realtime lights or baked?

Quality settings?

How many scripts are running updates per frame?