Persistent VRAM usage on loading Distant Horizons LODs.
VRAM usage on the GPU is persistent, even when leaving and rejoining the world. The initial "LOD Quality" preset that was loaded is "Extreme". Changing it to a lower preset does not change the VRAM usage numbers, however, when change back into "Extreme", the begins to climb rapidly as further LODs start loading in. I have a total of 512 chunks worth of LOD data in this world. Image attached are screenshots of the VRAM usage as well as F3 debug menu in-game with the following order:
1. First VRAM usage upon loading into the world for the first time.
2. In-game F3 screenshot of the FPS graphs and other relevant data.
Steps to reproduce:
1. Prior to joining a world, set Distance Generation to False LOD Quality preset to "Extreme".
2. Join a world and wait for the LODs to fully load. Once fully load, check VRAM usage in Task Manager for initial usage data.
3. Change "LOD Quality" preset to a lower one, wait for it to load (should be quick).
4. Once finished, leave the world, change the "LOD Quality" preset back to "Extreme", then rejoin the world.
5. At this point, wait for the LODs to finish loading in, after which you can start comparing the VRAM usage in Task Manager and notice it climbs up and not clearing.
Solution:Jump to solution
I just found and fixed a minor memory leak tied to the light map.
So that might help a bit going forward....
40 Replies
Don’t forget to ping James https://discord.com/channels/881614130614767666/881614131877269586/1260208345529188423
Relevant logs.
@James Seibel (GMT-6) here it is.
Hmm, can people see if they get pinged in forum posts?
:harold:
they can
i can at least
It may appear there are additional mods in this log, however, I have observe this behavior with only Distant Horizons, Sodium, Indium and Fabric API installed while testing the optimal performance settings for Distant Horizons.
I can retest with the other mods disabled if you prefer.
i cant replicate it
https://www.youtube.com/watch?v=_C785gJF3Io
I ran my game way longer than that
alright, ill afk in it
done lol
im afk for 15 minutes and still rock steady on 3,2 GB
try pushing the render distance maybe
its faster for me when i have distant generation
frick i need to redo the test. Minecraft crashed because of insufficient memory
well nevermind then
:harold:
i watched it reset
what did you do to reset it?
Not sure but this is the 2nd time i saw it
Same amount of wait
@hardester (GMT+8) Thanks for the reproduction steps, unfortunately I haven't been able to reproduce your issue.
Here's my memory at each step (render distance of 512):
medium
VRAM 2.4 GB
RAM 34.5 GB
extreme
VRAM 6.9 GB
RAM 46.4 GB
low
VRAM 2.7 GB
RAM 41.6 GB
re-load world
extreme
VRAM 6.8 GB
RAM 51 GB
low
VRAM 2.1 GB
RAM 37.3 GB
So while my system memory did increase a bit over the test it did decrease between the two low preset tests.
Although I have one other thing to check...
Do you happen to be using any JVM arguments by chance?
I may need to make more observation on this behavior. Since my system only have 8 GB of VRAM, the actual VRAM get maxed on first boot, which on subsequent reload, made the GPU start loading into system memory. Will try look into this behavior even more on my next revisit.
I've added an additional config option that should help with troubleshooting, if you could enable it next time you test.
Enable
DH Config -> Advanced -> Debugging -> Log Buffer Garbage Collection
to have the system log when VRAM buffers are being deleted and how many buffers are still active in VRAM.👌
Why is there some random
@mazumu
That put :ReadTheFAQ: on this
Lmao
Why????
i used default by launcher
-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M -Djava.net.preferIPv4Stack=true
Hmmm interesting.
Because from task manager it looks like the VRAM is being freed, just not right away.
So whether that's because Intel's driver doesn't run garbage collection until it has to or Java isn't running garbage collection, I can't tell.
You could enable the debug option I posted a couple messages up to see though.
I'm beginning testing again, now with this setting enabled. Be back once I got the logs ready.
Log seems a little large so, here it is with said setting enabled.
For this test, I made two changes to the reproduction step, that is omitting step 3 and ignoring changing LOD Quality in step 4. LOD Quality preset used throughout the test remains at "Extreme".
Presets other than "Extreme" have not been tested. Should you need test results for those, I can do so right now.
I can’t look at the logs easily on my mobile, but looking at the logs while in game does the buffer count keep rising or does it drop down?
And does your VRAM ever drop or does it only ever climb?
Because looking at the extreme preset I saw massive VRAM usage, but that wasn’t a leak, that’s just the preset being extremely demanding.
Let me reopen that log in Code.
The remaining buffer amount seems to hover around the same value, both on the first load and the second one. What I noticed is that it clears up until the remaining buffer count goes to around 260, before starts climbing back up to the highest count of around 17390 then persist around that.
Still, the so-called VRAM persistence is still there. The VRAM usage doesn't clear and begins climbing up again as it nearly finish loading all the LODs.
Interesting, I also managed to reproduce the effects with the "High" preset. Logs incoming.
Wait, this doesn't seem correct...
:hmmmm:
Minecraft truncates log if the date changes?
where is the boot up sequence?
that isnt a latest.log
Added the missing first half of the log. This should contain everything.
In this one, the only change made is setting LOD Quality to "High" for everything, all while following the same step changes as in this prior message.
This one peaked at around 3500, with drops to as low as 50 before climbing back up to the same average maximum.
VRAM usage report on the other hand, this is where things get interesting.
- On first load of the world, the VRAM usage peaks at about 2.4 GB as reported by Task Manager.
- On second load of the world, the VRAM usage stays roughly the same as before, only to begin climbing up upon nearing completion to 3.0 GB.
- Since loading the "High" is a lot faster than "Extreme", I managed to squeezed a third one, which sees yet another increase to 3.3 GB.
Since I managed to reproduce this effect on a different preset, here's an updated steps:
1. Prior to joining a world, set Distance Generation to False LOD Quality preset to any.
2. Join a world and wait for the LODs to fully load. Once fully load, check VRAM usage in Task Manager then write down the amount reported.
3. Leave the world then rejoin.
4. Once again, wait for the LODs to finish loading in, after which start comparing the VRAM usage with the previous one.
Can you get the VRAM usage to increase infinitely?
If it peaks at a certain value it isn’t leaking.
Seeing the trend on the second test, it may have a peak somewhere. I'll give it a try one more time.
Solution
I just found and fixed a minor memory leak tied to the light map.
So that might help a bit going forward.
:shaq:
Good to know.
Will try out any updated nightly with that fix to see any improvements.
its fixed 😄
🎉 Awesome!
I can also confirm it on my end.
I will mark this post as solved.