Next Previous Up Contents
Next: startable.writers
Up: System Properties
Previous: startable.storage

## A.9 startable.unmap

The `startable.unmap` property controls how memory-mapped buffers (`MappedByteBuffer`s) that have been allocated by STIL are unmapped when it can be determined that they will no longer be used. Specifically, it controls the implementation of the `Unmapper` class that will be used. See the implementation and comments in that class for further discussion. This is currently only used for FITS input, but it may be extended for other purposes in future versions.

Possible values are:

- `sun`: Best efforts unmapping based on available `sun.misc` classes, discovered by reflection.
- `cleaner`: Buffers are unmapped using non-J2SE classes including `sun.misc.Cleaner`, discovered by reflection. Expected to work for java6 through java8.
- `unsafe`: Buffers are unmapped using non-J2SE classes including `sun.misc.Unsafe`, discovered by reflection. Expected to work for java9 and later versions up to 22, and perhaps later but with user-visible WARNING messages.
- `memseg`: Buffers are unmapped using methods from `java.lang.foreign.MemorySegment`, discovered by reflection. Expected to work for Java 22 and later.
- `none`: No attempt is made to unmap buffers explicitly. They will be unmapped only when garbage collected.
- `default`: Attempts to choose the most suitable implementation based on classes available at runtime: `memseg`, then `sun`, then `none`.

You can also use the classname of an `Unmapper` implementation that has a no-arg constructor. If no value is supplied, behaviour is as `default`.

In general you are advised to leave this parameter alone. It is provided because the sun-like unmapping is doing fundamentally inadvisable things, and although I think it's done in a way which will not cause problems, nasty consequences like JVM crashes are possible if I've made mistakes, so it's a good idea to have a switch here that allows the dangerous behaviour to be switched off (`startable.unmap=none`).

Next Previous Up Contents
Next: startable.writers
Up: System Properties
Previous: startable.storage

STIL - Starlink Tables Infrastructure Library
Starlink User Note252
STIL web page: http://www.starlink.ac.uk/stil/
Author email: m.b.taylor@bristol.ac.uk