| Summary: | The timer code in HandledContributionItem creates enourmous numbers of GC'able objects | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] e4 | Reporter: | Eric Moffatt <emoffatt> | ||||
| Component: | UI | Assignee: | Paul Webster <pwebster> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | bokowski, john.arthorne, Mike_Wilson, pwebster, remy.suen | ||||
| Version: | unspecified | Flags: | Mike_Wilson:
pmc_approved+
remy.suen: review+ |
||||
| Target Milestone: | 4.1 RC4 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Eric Moffatt
I've just tried to see what the gc's performance impact is and it doesn't appear to be that major. My guess is that its because we're creating a static context per item, per 400 ms call. We dispose it right away so that it's available for GC ASAP, but as you noticed it continues to climb for a while. The other option would be to allocate the context per HCI instance, and then we only have to fill in the SWT Event object (or remove it as appropriate). That will stop the constant creation/destruction, but those contexts will show up in the Contexts debug view as they'll live until the HCI.dispose(). PW Created attachment 197701 [details]
Cache the static context per HCI v01
This creates one staticContext that is re-used and updated with correct information on every timer check for toolitems.
It slows the heap growth considerably. 30 Meg in the time it took my outer to grow 100 meg. The heap still grows as long as the timerExec(*) is running, but we don't create any more temp objects in this code. Even the safe runner is re-used per instance.
PW
Remy, could you review please? PW (In reply to comment #3) > Created attachment 197701 [details] > Cache the static context per HCI v01 This looks good to me. I don't see any behaviour indicative of rabid heap growth. Please delete the commented out line 318. One thing I noticed is that the context's interfaces are "static" but I am guessing that when a different model is inserted via setModel(MHandledItem) that a new contribution item would be spawned (with a new context being generated). We're considering this for RC4 PW Fix creates the context once and deletes it at the end. Released for post RC4. PW |