The native store uses integer id's in combination with a revision id to uniquely identify values. Inside a query execution this id is enough to identify and if needed retrieve the Value from the store.
Currently the PathIteration uses a HashSet for storing values that have been presented to the iteration consumer already to avoid sending duplicates. If instead we mark the bit in a bit set as seen we will never use more than 2mb for this set (+plus reference to store and versionid).
Basically it means implementing a Set<Value> specifically for use with the NativeStore that will replace the current reportedValues set implementation.