Java's garbage collection cannot be relied on to clean up everything. Specifically, subclasses of ``++org.eclipse.swt.graphics.Resource++`` must be manually ``++dispose()++``-ed when you're done with them. 

Particularly for the ``++Image++`` subclass, which retains an open ``++FileHandle++`` for the life of the instance, failure to properly ``++dispose++`` of ``++Resource++``s can result in a resource leak which could bring first the application and then perhaps the box it's on to their knees. 


== Noncompliant Code Example

[source,java]
----
import org.eclipse.swt.graphics.Image;

public class MyLeakyView {
  Image myImage = new Image("image/path");  // Noncompliant; not disposed
----


== Compliant Solution

[source,java]
----
import org.eclipse.swt.graphics.Image;

public class MyView {
  Image myImage = new Image("image/path");

  public void callMeWhenItsDone() {
    myImage.dispose();
  }
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::message.adoc[]

endif::env-github,rspecator-view[]
