Skip to content

Commit

Permalink
Destroy direct buffer promptly instead of waiting for GC
Browse files Browse the repository at this point in the history
  • Loading branch information
eduramiba committed Jun 12, 2024
1 parent 75fbdf2 commit 5800ba5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.gephi.viz.engine.jogl.util;

import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.GLBuffers;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;

Expand Down Expand Up @@ -55,6 +57,9 @@ public int getElementsCapacity() {
}

public void destroy() {
//NOOP
// Should always be, but let's be careful:
if (buffer instanceof ByteBuffer) {
GLBuffers.Cleaner.clean((ByteBuffer) buffer);
}
}
}

0 comments on commit 5800ba5

Please sign in to comment.