3 ms·
They have low-overhead temporal-, spatial-, and thread- safety guarantees. Spatial in that every “C pointer”=MemorySegment is associated with bounds, which is
by kaba0 3y ago
They have low-overhead temporal-, spatial-, and thread- safety guarantees. Spatial in that every “C pointer”=MemorySegment is associated with bounds, which is checked at runtime. Temporal, in that such a MemorySegment has a scope (usually created in a try-with resource block, being closed right afterwards, or alternatively at a random later point, up to the GC), outside of which it can’t be called (also, freeing actions can be associated with these). Thread safety, in that a scope also determines the availability of a given segment to other threads (must be explicitly specified to be accessible mutably from multiple threads).