Release timeout memory for scheduled tasks
Motivation: fix memory leak Modification: added a new release method and it will be called in ring buffer Result: to avoid memory leaks
This commit is contained in:
parent
8d464d5ab4
commit
96e0e5cc91
@ -230,6 +230,11 @@ final class IOUringSubmissionQueue {
|
||||
PlatformDependent.putLong(timeoutMemoryAddress + KERNEL_TIMESPEC_TV_NSEC_FIELD, nanoSeconds);
|
||||
}
|
||||
|
||||
//delete memory
|
||||
public void release() {
|
||||
Buffer.free(timeoutMemory);
|
||||
}
|
||||
|
||||
public void setSqeHead(long sqeHead) {
|
||||
this.sqeHead = sqeHead;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ final class RingBuffer {
|
||||
}
|
||||
|
||||
public void close() {
|
||||
getIoUringSubmissionQueue().release();
|
||||
Native.ioUringExit(this);
|
||||
}
|
||||
|
||||
|
@ -164,5 +164,13 @@ public class NativeTest {
|
||||
}.start();
|
||||
|
||||
waitingCqe.join();
|
||||
|
||||
ringBuffer.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ioUringExitTest() {
|
||||
RingBuffer ringBuffer = Native.createRingBuffer();
|
||||
ringBuffer.close();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user