Community
Participate
Working Groups
If you open the HeapStatus you can watch it grow by over a meg a second. While it will eventually GC this memory the result is that the garbage collector is 'locking' the system for longer than most apps due to the amount of work it has to do. We know that it's the timerExec because commenting out the code to restart the timer (lines 99-100) stops the heap from growing... Paul, I'm not sure whether this is actually fixable but we ought to look into it anyway to see if we can re-use the contexts.
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