[ 
https://issues.apache.org/jira/browse/JCR-1041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518568
 ] 

Christoph Kiehl commented on JCR-1041:
--------------------------------------

Well, according to various sources 
(http://martin.nobilitas.com/java/sizeof.html and 
http://www.javaworld.com/javaworld/javatips/jw-javatip130.html?page=2) an 
Integer instance needs 16 bytes. A native int needs 4 bytes. This is why I 
would prefer an array of ints (not even counting the TreeSet overhead which 
uses a TreeMap which wraps every Integer in an Entry instance).
The AdaptingHits class is only needed for corner cases where contextQuery 
result sets get really large. You could instead just use ArrayHits directly to 
resemble what a TreeSet would achieve just using less memory.
But I thought we could use those Hits classes in a few other places like 
DescendantSelfAxisQuery as well, where large contextQuery results are much more 
common.

> Avoid using BitSets in ChildAxisQuery to minimize memory usage
> --------------------------------------------------------------
>
>                 Key: JCR-1041
>                 URL: https://issues.apache.org/jira/browse/JCR-1041
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>            Assignee: Christoph Kiehl
>         Attachments: avoid_using_bitsets.patch
>
>
> When doing ChildAxisQueries on large indexes the internal BitSet instance 
> (hits) may consume a lot of memory because the BitSet is always as large as 
> IndexReader.maxDoc(). In our case we had a query consisting of 7 
> ChildAxisQueries which combined to a total of 14MB. Since we have multiple 
> users executing this query simultaneously this caused an out of memory error.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to