Project

Profile

Help

Bug #1481

closed

Memory "leak" caused by ThreadLocal converter cache

Added by Michael Kay about 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Performance
Sprint/Milestone:
-
Start date:
2012-04-17
Due date:
% Done:

100%

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

Description

Saxon maintains a cache of "converter" objects for converting/casting values from type A to type B: if the same conversion is performed repeatedly, this avoids complex navigation of the type hierarchy to decide what to do. The cache is an LRU cache held in ThreadLocal. Because the converter objects contain a reference to a Configuration, in the case where many Configuration objects are created they can end up not being garbage collected. The fact that the cache is LRU should avoid this in theory, but in practice it seems the number of ThreadLocal objects on the heap can greatly exceed the number of threads, leading to a large number of Configuration objects, and their associated resources such as the namePool and TypeHierarchy, being locked down in memory.


Related issues

Has duplicate Saxon - Bug #1619: Memory leak generated by ConversionRules cachingDuplicateMichael Kay2012-09-04

Actions
Actions #1

Updated by Michael Kay about 12 years ago

  • Status changed from New to Resolved

A patch for the 9.4 branch is being committed. The effect of the patch is to replace the thread-local LRU cache for converter objects with a shared thread-safe cache held by the ConversionRules object, that is, effectively, a cache owned by the Configuration.

(The 9.5 version of this fix additionally ensures that some requests for converters that currently bypass the cache no longer do so.)

Actions #2

Updated by Michael Kay almost 12 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 9.4.0.4

Please register to edit this issue

Also available in: Atom PDF