MCPcopy Create free account
hub / github.com/java-native-access/jna / shareReferenceIfInBounds

Method shareReferenceIfInBounds

src/com/sun/jna/Memory.java:771–781  ·  view source on GitHub ↗

Check whether the supplied Pointer object points into the memory region backed by this memory object. The intention is to prevent premature GC of the Memory object. @param target Pointer to check @return target if target does not point into the region covered by this memory object, a newly

(Pointer target)

Source from the content-addressed store, hash-verified

769 * points to memory backed by this Memory object.
770 */
771 private Pointer shareReferenceIfInBounds(Pointer target) {
772 if(target == null) {
773 return null;
774 }
775 long offset = target.peer - this.peer;
776 if (offset >= 0 && offset < this.size) {
777 return this.share(offset);
778 } else {
779 return target;
780 }
781 }
782
783 private static final class MemoryDisposer implements Runnable {
784

Callers 1

getPointerMethod · 0.95

Calls 1

shareMethod · 0.95

Tested by

no test coverage detected