This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
PositionRef$Manager keeps WeakReferences to Positions, but don't neither the references nor the LinkList$Items pointing to them. It should register the References to a reference queue and remove them (periodically). Also, holding the References in the LinkedList has high memory overhead, as the LL$Item is itself as big as the Reference itself. Implement some internal linkage scheme instead of using LinkedList.
see http://www.netbeans.org/servlets/ReadMsg?msgId=243074&listName=nbdev for outline of a solution
There is also related issue to this one #19780.
Created attachment 4420 [details] Diff of proposed patch
Created attachment 4421 [details] Proposed patch (lib/patches dir)
Petr, please look at it if it is the what we need. I tested it just from the point how often the sweeping is scheduled and how fast it is. The sweeping task takes up to 4ms (0ms for small sources, 4ms for larger sources), seemed to work in reasonable intervals.
Patch looks fine. Btw. what do you think I did last week: http://www.netbeans.org/source/browse/openidex/looks/src/org/netbeans/api/looks/Attic/Look.java.diff?r1=1.1.2.14&r2=1.1.2.15
Peter: You've got the idea, now make the "next" public for simplier access, inline the sweeping pass to the conversion (you're going to iterate over the whole array anyway so why to schedule the cleaning to happen just after (or worse - during) the conversion) and do less grained locking (while() { synchronized() {}} is not the best thing. The only thing that is missing there is some periodic sweep which is still needed because of #19780 and similar access patterns. But I'd rather design some generic support for it first... Yarda: Inlined collections are nice thing, espacially if they are absolutely memory penalty free. I know little about your changed class but I believe your chains will be short enough to not need RQ and periodic cleaning.
Fixed in [main-trunk] Fix: openide/../text/PostionRef.java [1.42] Note: I applied to the fix Petr's refinements from prev comment.
The impelentation you checked in has a problem of not converting the last item in the list. Also the bound checking can be implemented in a simplier way. I'll commit a better version tomorrow (I've already prepared it).
Finally fixed. Who will verify it for me? :-)
verified
Resolved for 3.4.x or earlier, no new info since then -> closing.