Considering the following code snippet and overlooking the lack of a using clause or an explicit disposal:
public static Image GetImage(string imageName)
{
Image image = null;
Stream unmanagedMemoryStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(imageName);
image = Image.FromStream(unmanagedMemoryStream);
return image;
}
When will Dispose() be called on unmanagedMemoryStream? How would this change if the containing method was made non-static? Is a leak of unmanaged memory possible in this situation?