Bug #3260
closedSequence size incorrecly reported as 50
100%
Description
Congratulations on completing XSLT 3.0, and thanks for releasing Saxon 9.8!
With Saxon-HE 9.8.0.1, I have observed the size of a sequence being maintained incorrectly. The attached program issues some tracing in line 418. It shows that count($stack) at one point is shown as 50, though the last item in $stack is at index 36.
Not sure whether there is any relation, but this reminded me of an old issue that I had reported some 4 years ago: http://markmail.org/message/qzixjoaxmp2xq34y
Files
Updated by Michael Kay over 7 years ago
- Category set to Internals
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Fix Committed on Branch 9.8, trunk added
It's certainly in the same area as the previous bug, though not quite the same bug.
The MemoClosure / MemoSequence allocates a reservoir (buffer) of initial size 50 which is incrementally filled with items as required. If items are accessed by subscript, it reads input items up to the required subscript. When count is called, it reads all remaining items from the input and returns the total number of items in the reservoir. The code is incorrectly assuming that when all items have been read, the "reservoir" array will be the correct length. But in fact it is only condensed (from the initial size of 50) if the space saving looks worthwhile. If 30 items have been used, it decides that copying the array isn't worthwhile, but then incorrectly returns the length of the sequence as 50 rather than 30.
Patch committed to MemoSequence.ProgressiveIterator.materialize().
Updated by Michael Kay over 7 years ago
QT3 test case app-Demos/RexParser created
Updated by Gunther Rademacher over 7 years ago
Where would I find the patch? I was looking for https://dev.saxonica.com/repos/archive/opensource/latest9.8 , but that does not seem to exist.
Updated by Michael Kay over 7 years ago
We haven't yet established a 9.8 branch in the public repository, it should be there within a few days.
Updated by Gunther Rademacher over 7 years ago
Thank you for the quick fix. With the patch this works fine now.
Updated by O'Neil Delpratt over 7 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.8.0.2 added
Patch applied in the Saxon 9.8.0.2 maintenance release
Please register to edit this issue