You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Ludger Bünger (JIRA)" <xe...@xml.apache.org> on 2008/04/07 15:24:25 UTC

[jira] Created: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
---------------------------------------------------------------------------------------------------------------------

                 Key: XERCESJ-1299
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
             Project: Xerces2-J
          Issue Type: Improvement
          Components: DOM (Level 2 Traversal & Range)
            Reporter: Ludger Bünger


NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Updated: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich updated XERCESJ-1299:
------------------------------------------

    Affects Version/s: 2.9.1

> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1299
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
>             Project: Xerces2-J
>          Issue Type: Improvement
>          Components: DOM (Level 2 Traversal & Range)
>    Affects Versions: 2.9.1
>            Reporter: Ludger Bünger
>            Assignee: Michael Glavassevich
>            Priority: Trivial
>         Attachments: WeakNodeIterator.txt
>
>
> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Updated: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

Posted by "Ludger Bünger (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ludger Bünger updated XERCESJ-1299:
-----------------------------------

    Attachment: WeakNodeIteratorArrayList.txt

I have it right here at hand (also for NodeIterators -> see attached Patch).

Maybe it inspires somehow but to me it looks roughly equivalent.

Main difference is that I used an ArrayList instead of a LinkedList.
The main advantage of the linked list we require here is the constant time entry removal.
I worked around this by copying the last entry to the to-be-removed position so that no array copying (usually taking O(n) processing time) is done.

Since there is no order defined upon iterator notification (same with range notification) I think this is ok.

> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1299
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
>             Project: Xerces2-J
>          Issue Type: Improvement
>          Components: DOM (Level 2 Traversal & Range)
>    Affects Versions: 2.9.1
>            Reporter: Ludger Bünger
>            Assignee: Michael Glavassevich
>            Priority: Trivial
>             Fix For: 2.10.0
>
>         Attachments: WeakNodeIterator.txt, WeakNodeIteratorArrayList.txt
>
>
> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Updated: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

Posted by "Ludger Bünger (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ludger Bünger updated XERCESJ-1299:
-----------------------------------

    Attachment: WeakNodeIterator.txt

This patch changes the vector currently storing NodeIterators to a WeakHashMap (used as like set by the NodeIterator as key and "null" as value) allowing for NodeIterator garbage collection.

> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1299
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
>             Project: Xerces2-J
>          Issue Type: Improvement
>          Components: DOM (Level 2 Traversal & Range)
>            Reporter: Ludger Bünger
>         Attachments: WeakNodeIterator.txt
>
>
> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Commented: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

Posted by "Ludger Bünger (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790236#action_12790236 ] 

Ludger Bünger commented on XERCESJ-1299:
----------------------------------------

I do not know how far your code has already progressed. 

Since I do have a patch (tested and running since roughly a year now in our application) are you interested or is there no need anymore?

> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1299
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
>             Project: Xerces2-J
>          Issue Type: Improvement
>          Components: DOM (Level 2 Traversal & Range)
>    Affects Versions: 2.9.1
>            Reporter: Ludger Bünger
>            Assignee: Michael Glavassevich
>            Priority: Trivial
>             Fix For: 2.10.0
>
>         Attachments: WeakNodeIterator.txt
>
>
> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Resolved: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich resolved XERCESJ-1299.
-------------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.10.0

Thanks. I switched the WeakHashMap over to a LinkedList of WeakReferences as it seems to do a better job of reducing its memory usage as items are removed and can be cleaned up nicely through its iterator. The changes are under SVN rev 890145.

> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1299
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
>             Project: Xerces2-J
>          Issue Type: Improvement
>          Components: DOM (Level 2 Traversal & Range)
>    Affects Versions: 2.9.1
>            Reporter: Ludger Bünger
>            Assignee: Michael Glavassevich
>            Priority: Trivial
>             Fix For: 2.10.0
>
>         Attachments: WeakNodeIterator.txt
>
>
> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Commented: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790588#action_12790588 ] 

Michael Glavassevich commented on XERCESJ-1299:
-----------------------------------------------

The other advantage of the LinkedList is that it doesn't leave unused space around like the array based implementations when you remove items from it. Unless you call ArrayList.trimToSize() at some point the underlying array will always be at its maximum size (since the ArrayList was created).

> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1299
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
>             Project: Xerces2-J
>          Issue Type: Improvement
>          Components: DOM (Level 2 Traversal & Range)
>    Affects Versions: 2.9.1
>            Reporter: Ludger Bünger
>            Assignee: Michael Glavassevich
>            Priority: Trivial
>             Fix For: 2.10.0
>
>         Attachments: WeakNodeIterator.txt, WeakNodeIteratorArrayList.txt
>
>
> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Commented: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790238#action_12790238 ] 

Michael Glavassevich commented on XERCESJ-1299:
-----------------------------------------------

I'm fairly far along (planning to commit it today), though It might help inspire a better solution, but if it's going to take you awhile to dig it up I wouldn't worry about it. Thanks.

> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1299
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
>             Project: Xerces2-J
>          Issue Type: Improvement
>          Components: DOM (Level 2 Traversal & Range)
>    Affects Versions: 2.9.1
>            Reporter: Ludger Bünger
>            Assignee: Michael Glavassevich
>            Priority: Trivial
>             Fix For: 2.10.0
>
>         Attachments: WeakNodeIterator.txt
>
>
> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Commented: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

Posted by "Ludger Bünger (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790230#action_12790230 ] 

Ludger Bünger commented on XERCESJ-1299:
----------------------------------------

Hi Michael,

interestingly, I had the same idea too and had a patch flying around doing roughly the same as your solution.
I just never came along attaching it to this issue.

Since we iterate over the iterator list in any case, my solution did not do a prior full cleanup upon the iterator list each time removing the need for a ReferenceQueue and thus using the then slightly more performant ArrayList.

I don't know whether you are interested in this patch since the idea is essentially the same.

However I'll attach an equivalent patch for the range issue (issue #1300) I have "flying around" too.

> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1299
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
>             Project: Xerces2-J
>          Issue Type: Improvement
>          Components: DOM (Level 2 Traversal & Range)
>    Affects Versions: 2.9.1
>            Reporter: Ludger Bünger
>            Assignee: Michael Glavassevich
>            Priority: Trivial
>             Fix For: 2.10.0
>
>         Attachments: WeakNodeIterator.txt
>
>
> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Commented: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790234#action_12790234 ] 

Michael Glavassevich commented on XERCESJ-1299:
-----------------------------------------------

Hi Ludger, FYI: I'd already started doing something similar for the Ranges.

> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1299
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
>             Project: Xerces2-J
>          Issue Type: Improvement
>          Components: DOM (Level 2 Traversal & Range)
>    Affects Versions: 2.9.1
>            Reporter: Ludger Bünger
>            Assignee: Michael Glavassevich
>            Priority: Trivial
>             Fix For: 2.10.0
>
>         Attachments: WeakNodeIterator.txt
>
>
> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Updated: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

Posted by "Ludger Bünger (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ludger Bünger updated XERCESJ-1299:
-----------------------------------

    Priority: Trivial  (was: Major)

> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1299
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
>             Project: Xerces2-J
>          Issue Type: Improvement
>          Components: DOM (Level 2 Traversal & Range)
>            Reporter: Ludger Bünger
>            Priority: Trivial
>         Attachments: WeakNodeIterator.txt
>
>
> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Assigned: (XERCESJ-1299) NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich reassigned XERCESJ-1299:
---------------------------------------------

    Assignee: Michael Glavassevich

> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1299
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1299
>             Project: Xerces2-J
>          Issue Type: Improvement
>          Components: DOM (Level 2 Traversal & Range)
>            Reporter: Ludger Bünger
>            Assignee: Michael Glavassevich
>            Priority: Trivial
>         Attachments: WeakNodeIterator.txt
>
>
> NodeIterators should be garbage collectable if the node iterators are not referenced by the main application anymore.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org