Closed JonasKunz closed 7 months ago
Do you think we could add a unit test to ensure keeping the reference is explicitly tested
I initially thought it was hard to test, because we can't now whether the native pointer points into garbage or not. But after some more thinking I came up with a test to simply check that the provided buffer is kept alive.
I've added the testcase
For the profiling correlation we have a native global variable for providing the profiler with process-level information, e.g. the service name. This global variable points to the native memory contents of a
ByteBuffer
. Therefore we must ensure that the currently usedByteBuffer
is not GCed, otherwise the content to which the native global variable points may become invalid.