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)
| 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 |