aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-06-07 21:58:51 +0200
committermakamys <makamys@outlook.com>2022-06-07 21:58:51 +0200
commitfd1ad07f7e9759c43c3dae0affcaa910b06d2fb1 (patch)
tree2add269b5ed79eeeb8a63f3a32d517ac35e6a038 /src/main/java/makamys
parent3814324d0d83ebf600874356d65687958cd4e42e (diff)
downloadNeodymium-fd1ad07f7e9759c43c3dae0affcaa910b06d2fb1.tar.gz
Neodymium-fd1ad07f7e9759c43c3dae0affcaa910b06d2fb1.tar.bz2
Neodymium-fd1ad07f7e9759c43c3dae0affcaa910b06d2fb1.zip
Fix infinite loop in GC
Diffstat (limited to 'src/main/java/makamys')
-rw-r--r--src/main/java/makamys/lodmod/renderer/GPUMemoryManager.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/makamys/lodmod/renderer/GPUMemoryManager.java b/src/main/java/makamys/lodmod/renderer/GPUMemoryManager.java
index 7693b4a..d8c0c27 100644
--- a/src/main/java/makamys/lodmod/renderer/GPUMemoryManager.java
+++ b/src/main/java/makamys/lodmod/renderer/GPUMemoryManager.java
@@ -38,10 +38,11 @@ public class GPUMemoryManager {
long t0 = System.nanoTime();
int moved = 0;
+ int checksLeft = sentMeshes.size();
Mesh startMesh = null;
- while(moved < 5 && !sentMeshes.isEmpty()) {
+ while(moved < 5 && checksLeft-- > 0 && !sentMeshes.isEmpty()) {
if(nextMesh >= sentMeshes.size()) {
nextMesh = 0;
}