Project: Eclipse_Platform_UI
Bug 78860 [Progress] UIJob uses lots of resources
Reported: 2004-11-17 13:22:07 | Status: verified fixed

I had a memory monitor plugin that graphed the available memory over time. I wrote it using java.util.Timer. The graph looked flat. I re-implemented it using UIJob. The graph became a saw-tooth. The following code illustrates the problem. Create a plugin project. Add the org.eclipse.ui.ActionSets extension and choose the Hello World example. In the run method, add the following code: UIJob j = new UIJob("Tester"){ private int count = 10000; public IStatus runInUIThread(IProgressMonitor monitor) { long total = Runtime.getRuntime().totalMemory()/1024; long free = Runtime.getRuntime().freeMemory()/1024; System.out.println("Total= "+total+" free= "+free); if (--count > 0) schedule(1000); return Status.OK_STATUS; }}; j.schedule(1000); Run the workbench and run the action set. The output should be something like this: Total= # free= # The free value should not be changing. In this instance it is going down continually until there is a GC when it jumps back up.

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/FinishedJobs.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java