Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High memory usage causing lag spikes on OpenGL (2023.4.19, Linux) #23252

Open
Memresable opened this issue Apr 20, 2023 · 16 comments
Open

High memory usage causing lag spikes on OpenGL (2023.4.19, Linux) #23252

Memresable opened this issue Apr 20, 2023 · 16 comments

Comments

@Memresable
Copy link

Memresable commented Apr 20, 2023

Type

Performance

Bug description

The startup of the game became much slower, things aren't as smooth as before, due to memory usage being both really high on VRAM and usual RAM in the recent release (2023.4.19 on Linux) on OpenGL (haven't tried the legacy one) It became unplayable for me

I even commented on a pull request on what I thought caused this problem (I assumed on what caused it, no clue what is the actual cause) on this issue: ppy/osu-framework#5508 but there weren't any comments on it after hours at the time of writing this

Screenshots or videos

2023-04-20.12-07-02.mp4

Version

2023.4.19

Logs

database.log
input.log
network.log
performance.log
runtime.log

@peppy
Copy link
Member

peppy commented Apr 20, 2023

Could you please try the legacy opengl renderer? Is there a reason you are not willing to?

@Memresable
Copy link
Author

I tried the legacy one and it runs just fine there, also also there really wasn't a reason, I just wanted to try the latest renderers and not bothered with the legacy one

@frenzibyte
Copy link
Member

If you're interested, can you give ppy/osu-framework@master...frenzibyte:osu-framework:compute-mipmap-generation a test and see if it helps? See https://github.com/ppy/osu-framework/wiki/Testing-local-framework-checkout-with-other-projects for how to build osu! with local framework checkout. If you're not familiar with the process, then you can wait until the changes get in.

@qwert0p
Copy link

qwert0p commented Apr 20, 2023

I've tested the game with that framework branch, it certainly works better, ram usage doesn't skyrocket like release, but it's still getting filled up slowly.

@frenzibyte
Copy link
Member

Try decreasing TextureStore.max_atlas_size to 1024x1024 and see if that matches what you get on previous release.

@qwert0p
Copy link

qwert0p commented Apr 20, 2023

It doesn't, previous release uses way less memory and it counts towards the process, current build somehow doesn't. Also when i decreased atlas size to 1024 it seems to crash when i open the map with veldrid exception and legacy renderer segfaults on start.

@frenzibyte
Copy link
Member

frenzibyte commented Apr 20, 2023

Are you sure? It works perfectly fine for me.

diff --git a/osu.Framework/Graphics/Textures/TextureStore.cs b/osu.Framework/Graphics/Textures/TextureStore.cs
index 9d1d24d97..5812205d9 100644
--- a/osu.Framework/Graphics/Textures/TextureStore.cs
+++ b/osu.Framework/Graphics/Textures/TextureStore.cs
@@ -34,7 +34,7 @@ public class TextureStore : ITextureStore
 
         protected TextureAtlas Atlas;
 
-        private const int max_atlas_size = 4096;
+        private const int max_atlas_size = 1024;
 
         /// <summary>
         /// Decides at what resolution multiple this <see cref="TextureStore"/> is providing sprites at.

Please specify the Veldrid exception you're seeing as well.

@qwert0p
Copy link

qwert0p commented Apr 20, 2023

Okay, i hope I'm not dumb enough to mess up changing a number in the source code, there are the logs(running release mode, crashes even before the logo appears on debug)
runtime.log
performance.log
network.log
input.log
database.log

@frenzibyte
Copy link
Member

That's pretty weird, you'll have to investigate that yourself. Try attaching a breakpoint in generateMipmapsViaComputeShader and see which CreateTextureView call is failing and why so.

@frenzibyte
Copy link
Member

frenzibyte commented Apr 20, 2023

Never mind, @qwert0p fetch latest changes and check again. The fact that it only broke when changing max_atlas_size could be a sign that the compute shader wasn't running at all for you, so please check on both 4096x4096 and 1024x1024 atlas sizes again and report back memory usage.

@qwert0p
Copy link

qwert0p commented Apr 20, 2023

Yep, seems much better now, nothing seems to crash or behave weirdly and ram usage seems reasonable. I'll check everything tomorrow and report properly.

@chairclr
Copy link

Seemingly same issue occurring on Windows 10 (Veldrid / OpenGL).

@frenzibyte
Copy link
Member

There's no helpful information in your comment.

@frenzibyte frenzibyte changed the title High memory usage causing lag spikes (2023.4.19, Linux) High memory usage causing lag spikes on OpenGL (2023.4.19, Linux) Apr 21, 2023
@qwert0p
Copy link

qwert0p commented Apr 21, 2023

So, i rechecked and atlas resizing doesn't cause any crashes now, but memory leak still occurs and it's pretty much the same on 1024x1024 as it is on 4096x4096.

@tematikkp
Copy link

Not only that, but #23255

@Thesola10
Copy link

Is that the "shared memory" usage that didn't show up in a process or in-memory filesystem? I'm on Intel UHD btw, I don't know if there's a tool to track VRAM usage for that.

@frenzibyte frenzibyte removed their assignment Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants