All operations on the returned contents must be accompanied by
a live reference to the Data object, in order to keep a
reference towards the Memory owning the contents.
Be sure not to lose Data references while using their contents!
For example, avoid code like this:
getSomeData() // returns Data
.unsafeContents// returns ubyte[]
.useContents(); // uses the ubyte[] ... while there is no Data to reference it
The Data return value may be unreachable once .unsafeContents is evaluated.
Use .toGC instead of .unsafeContents in such cases to safely get a GC-owned copy,
or use .enter(contents => ...) to safely get a temporary reference.
Get the referenced data. Unsafe!
All operations on the returned contents must be accompanied by a live reference to the Data object, in order to keep a reference towards the Memory owning the contents.
Be sure not to lose Data references while using their contents! For example, avoid code like this:
The Data return value may be unreachable once .unsafeContents is evaluated. Use .toGC instead of .unsafeContents in such cases to safely get a GC-owned copy, or use .enter(contents => ...) to safely get a temporary reference.