2 ms·
But this looks like a bug in the program (or the VM): either that copy back to the heap should not be occuring, or there should be some locking here. What if th
by pmjordan 17y ago
But this looks like a bug in the program (or the VM): either that copy back to the heap should not be occuring, or there should be some locking here. What if the data was changed? Would the Java thread just be expected to deal with all intermediate states? Alternatively, if the data is read-only, don't write to it!
In the comments to the post you can see that the correct way to prevent a copy back would be to release the memory using JNI_ABORT. As far as I know, there's no way to enforce immutability on array contents in Java, so it's an implicit contract in the system: the contents really never does change.