The WritableMemory.allocateDirect returns a WritableHandle that implements AutoCloseable. And just as in C, when you malloc memory you are responsible to release that memory. In this case it is done with a try-with-resources block. As you will see in the fix.
The WritableMemory.allocateDirect returns a WritableHandle that implements AutoCloseable. And just as in C, when you malloc memory you are responsible to release that memory. In this case it is done with a try-with-resources block. As you will see in the fix.