Project

Profile

Help

Bug #2820

closed

Location information locks source stylesheet tree into memory

Added by Michael Kay over 7 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Performance
Sprint/Milestone:
-
Start date:
2016-07-04
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
10
Fixed in Maintenance Release:
Platforms:

Description

Not confirmed, but from looking at the code, when we compile an instruction, e.g. XSLElement.compile(), we set location information on the compiled instruction by calling StyleElement.allocateLocation(), and this uses the StyleElement itself as the Location object. This means that the source XSLT tree is referenced from the compiled expression tree, and cannot be garbage collected.

When fixing this, we need to check that there aren't any other links holding the source stylesheet tree in memory. At one time the code was carefully designed to avoid this but there may have been other lapses, since it's difficult to test.

It may be appropriate for the Location object to be the source element in cases where tracing is enabled, to make life easier for debuggers.

Actions #1

Updated by Michael Kay over 7 years ago

Sometimes instead of using StyleElement.allocateLocation(), we use StyleElement.getLocation(), which does exactly the same thing...

Actions #2

Updated by Michael Kay over 7 years ago

  • Status changed from New to Resolved
  • Fix Committed on Branch 9.8 added

On the 9.8 branch I have combined StyleElement.getLocation() and styleElement.allocateLocation() into a single method which (if necessary) creates an ExplicitLocation object and returns it. As far as I can see this solves the problem: looking at a heap dump, there are no instances of StyleElement left around at runtime.

There is a danger though that the use of a different Location object will affect diagnostics on failure paths, and this is hard to test for. So I'm going to be cautious and not apply this change on the 9.7 branch, at least for the time being.

Actions #3

Updated by O'Neil Delpratt almost 7 years ago

  • Fix Committed on Branch trunk added
  • Fix Committed on Branch deleted (9.8)
Actions #4

Updated by O'Neil Delpratt about 4 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fix Committed on Branch 10 added
  • Fix Committed on Branch deleted (trunk)
  • Fixed in Maintenance Release 10.0 added

Bug fix applied in the Saxon 10.0 major release.

Please register to edit this issue

Also available in: Atom PDF