Open
Description
There is some potential misinformation in an example from the tutorial titled "Working with an entry within a context"
The example has this line of code and proceeding comment:
PostalCodeRange range = entry.value().get();
// Access the off-heap memory directly, by calling range
// object getters.
// This is very rewarding, when the value has a lot of fields
// and expensive to copy to heap all of them, when you need to access
// just a few fields.
The comment seems to suggest that invoking getters would only deserialize the relevant part of the object from the off-heap storage.
However from poking around the source it seems to me that entry.value()
returns a CompiledMapQueryContext$EntryValueBytesData
(which I have confirmed in a pet project) and the get()
method deserializes the entire value into a cached object. Really no different from calling getUsing()
and passing in your own object.
My belief is the comment is simply incorrect. But looking for confirmation?
Activity