Skip to content

Memory leak in GEF FigureUtilities #443

@HeikoKlare

Description

@HeikoKlare

Description
GEF's FigureUtilities create a GC once for an application and then reuse it to calculate font/text dimensions. Due to the modification of GC to store Operations, every operation on FigureUtilities that sets the font on the GC (i.e., that calls setFont()) creates a SetFontOperation in the GC. Since that GC is never dispose, these operation accumulate throughout the application lifecycle and constitute a memory leak

Reproduction

  • Start an Eclipse product with GEF installed
  • Open and close any GEF diagram (such as an empty Logic or Shapes example)
  • Take a memory heapdump, e.g., with VisualVM
  • Open and close the same GEF diagram one or multiple times
  • Take another memory heapdump and compare with the original one

You see that the number of org.eclipse.swt.graphics.GC$SetFontOperation objects in the heap increased (and increases with every GEF diagram that is opened).

Expected Behavior
After closing a GEF diagram, the number of memory objects should be the same as before opening the diagram. In particular, there should not be a leak in a GC instance.

Metadata

Metadata

Assignees

Labels

GEFIssue for GEFHiDPIA HiDPI-Related Issue or FeatureSWTIssue for SWT

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions