# Uses of Interface
jdk.incubator.foreign.MemoryAddress

Packages that use MemoryAddress
Package
Description
jdk.incubator.foreign
Classes to support low-level and efficient foreign memory/function access, directly from Java.

## Uses of MemoryAddress in jdk.incubator.foreign

Fields in jdk.incubator.foreign declared as MemoryAddress
Modifier and Type
Field
Description
`static final MemoryAddress`
MemoryAddress.`NULL`
The native memory address instance modelling the `NULL` address, associated with the global resource scope.
Methods in jdk.incubator.foreign that return MemoryAddress
Modifier and Type
Method
Description
`MemoryAddress`
MemoryAddress.`addOffset(long offset)`
Creates a new memory address with given offset (in bytes), which might be negative, from current one.
`MemoryAddress`
Addressable.`address()`
Map this object into a `MemoryAddress` instance.
`MemoryAddress`
CLinker.VaList.`address()`
Returns the memory address of the C `va_list` associated with this instance.
`default MemoryAddress`
MemoryAddress.`address()`
`MemoryAddress`
MemorySegment.`address()`
The base memory address associated with this memory segment.
`static MemoryAddress`
CLinker.`allocateMemory(long size)`
Allocates memory of given size using malloc.
`static MemoryAddress`
MemoryAccess.`getAddress(MemorySegment segment)`
Reads a memory address from given segment, with byte order set to `ByteOrder.nativeOrder()`.
`static MemoryAddress`
MemoryAccess.`getAddressAtIndex(MemorySegment segment, long index)`
Reads a memory address from given segment and element index, with byte order set to `ByteOrder.nativeOrder()`.
`static MemoryAddress`
MemoryAccess.`getAddressAtOffset(MemorySegment segment, long offset)`
Reads a memory address from given segment and offset, with byte order set to `ByteOrder.nativeOrder()`.
`static MemoryAddress`
MemoryAddress.`ofLong(long value)`
Obtain a native memory address instance from given long address.
`MemoryAddress`
CLinker.`upcallStub(MethodHandle target, FunctionDescriptor function, ResourceScope scope)`
Allocates a native stub with given scope which can be passed to other foreign functions (as a function pointer); calling such a function pointer from native code will result in the execution of the provided method handle.
`MemoryAddress`
CLinker.VaList.`vargAsAddress(MemoryLayout layout)`
Reads the next value as a `MemoryAddress` and advances this va list's position.
Methods in jdk.incubator.foreign that return types with arguments of type MemoryAddress
Modifier and Type
Method
Description
`Optional<MemoryAddress>`
SymbolLookup.`lookup(String name)`
Looks up a symbol with given name in this lookup.
Methods in jdk.incubator.foreign with parameters of type MemoryAddress
Modifier and Type
Method
Description
`default MemorySegment`
MemorySegment.`asSlice(MemoryAddress newBase)`
Obtains a new memory segment view whose base address is the given address, and whose new size is computed by subtracting the address offset relative to this segment (see `segmentOffset(MemorySegment)`) from this segment size.
`default MemorySegment`
MemorySegment.`asSlice(MemoryAddress newBase, long newSize)`
Obtains a new memory segment view whose base address is the given address, and whose new size is specified by the given argument.
`static void`
CLinker.`freeMemory(MemoryAddress addr)`
Frees the memory pointed by the given memory address.
`static CLinker.VaList`
CLinker.VaList.`ofAddress(MemoryAddress address)`
Constructs a new `VaList` instance out of a memory address pointing to an existing C `va_list`, backed by the global resource scope.
`static CLinker.VaList`
CLinker.VaList.`ofAddress(MemoryAddress address, ResourceScope scope)`
Constructs a new `VaList` instance out of a memory address pointing to an existing C `va_list`, with given resource scope.
`static String`
CLinker.`toJavaString(MemoryAddress addr)`
Converts a UTF-8 encoded, null-terminated C string stored at given address into a Java string.