Skip to content

Commit 00f3013

Browse files
BloCamLimbxCollateral
authored andcommitted
Fix 1 leak
1 parent 2eabf9a commit 00f3013

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/java/net/vulkanmod/vulkan/shader/DescriptorSets.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public class DescriptorSets {
2525

2626
private final Pipeline pipeline;
2727
private int poolSize = 10;
28-
private long descriptorPool;
29-
private LongBuffer sets;
28+
private long descriptorPool = VK_NULL_HANDLE;
29+
private long[] sets;
3030
private long currentSet;
3131
private int currentIdx = -1;
3232

@@ -149,7 +149,7 @@ private void updateDescriptorSet(MemoryStack stack, UniformBuffer uniformBuffer)
149149
// Check pool size
150150
checkPoolSize(stack);
151151

152-
this.currentSet = this.sets.get(this.currentIdx);
152+
this.currentSet = this.sets[this.currentIdx];
153153

154154
VkWriteDescriptorSet.Buffer descriptorWrites = VkWriteDescriptorSet.calloc(pipeline.buffers.size() + pipeline.imageDescriptors.size(), stack);
155155
VkDescriptorBufferInfo.Buffer[] bufferInfos = new VkDescriptorBufferInfo.Buffer[pipeline.buffers.size()];
@@ -229,7 +229,8 @@ private void createDescriptorSets(MemoryStack stack) {
229229
allocInfo.descriptorPool(descriptorPool);
230230
allocInfo.pSetLayouts(layout);
231231

232-
this.sets = MemoryUtil.memAllocLong(this.poolSize);
232+
// Not hotspot code, use heap array
233+
this.sets = new long[this.poolSize];
233234

234235
int result = vkAllocateDescriptorSets(DEVICE, allocInfo, this.sets);
235236
if (result != VK_SUCCESS) {

0 commit comments

Comments
 (0)