Yu Li created FLINK-15919: ----------------------------- Summary: MemoryManager shouldn't allow releasing more memory than reserved Key: FLINK-15919 URL: https://issues.apache.org/jira/browse/FLINK-15919 Project: Flink Issue Type: Bug Components: Runtime / Task Affects Versions: 1.10.0 Reporter: Yu Li
Currently {{MemoryManager}} allows releasing more memory than reserved for an owner object, which could be reproduced by adding below test case into {{MemoryManagerTest}}: {code} @Test public void testMemoryReleaseGuard() throws MemoryReservationException { Object owner = new Object(); Object owner2 = new Object(); long totalHeapMemorySize = memoryManager.getMemorySizeByType(MemoryType.HEAP); memoryManager.reserveMemory(owner, MemoryType.HEAP, PAGE_SIZE); memoryManager.reserveMemory(owner2, MemoryType.HEAP, PAGE_SIZE); memoryManager.releaseMemory(owner, MemoryType.HEAP, PAGE_SIZE); memoryManager.releaseMemory(owner, MemoryType.HEAP, PAGE_SIZE); long heapMemoryLeft = memoryManager.getMemorySizeByType(MemoryType.HEAP); assertEquals("Memory leak happens", totalHeapMemorySize - PAGE_SIZE, heapMemoryLeft); } {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)