/** * A utility method to register easily a {@link CustomDeallocator} with a Pointer. * * @param p the Pointer with which to register the deallocator * @return the Pointer */ protected static <P extends Pointer> P withDeallocator(P p) { return (P)p.deallocator(new CustomDeallocator(p)); }