From f56ba0d73a404e3bd33cad4a861139eca0545a83 Mon Sep 17 00:00:00 2001 From: Josiah Date: Thu, 4 Jan 2024 05:58:22 -0500 Subject: [PATCH] #2176 Make LWJGLBufferAllocator use nmemCalloc() instead of nmemAlloc() https://github.com/jMonkeyEngine/jmonkeyengine/issues/2176 LWJGLBufferAllocator.allocate() now always returns zero-initialized buffers. --- .../src/main/java/com/jme3/util/LWJGLBufferAllocator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/util/LWJGLBufferAllocator.java b/jme3-lwjgl3/src/main/java/com/jme3/util/LWJGLBufferAllocator.java index 75e27c5400..c406da86de 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/util/LWJGLBufferAllocator.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/util/LWJGLBufferAllocator.java @@ -210,7 +210,7 @@ long getAddress(final Buffer buffer) { @Override public ByteBuffer allocate(final int size) { - final Long address = MemoryUtil.nmemAlloc(size); + final Long address = MemoryUtil.nmemCalloc(size, 1); final ByteBuffer byteBuffer = MemoryUtil.memByteBuffer(address, size); DEALLOCATORS.put(address, createDeallocator(address, byteBuffer)); return byteBuffer;