Highlighted
Absent Member.
Absent Member.
1056 views

Displaying Images uses up PC memory

Jump to solution

Hi,

I display images on a windows form using the following code:-

set picView::"Image" to type "System.Drawing.Image"::"FromFile"(ws-string)

However if this form is repeatedly loaded displaying different images the pc memory goes up and up until eventually i see an out of memory error.

So found this:-

http://msdn.microsoft.com/en-us/library/system.drawing.image.dispose(v=vs.90).aspx

Which I assume gets converted into cobol code as follows:-

invoke self::"Dispose"()

Which I put straight after the "set picView::"Image" to type "System.Drawing.Image"::"FromFile"(ws-string)" line.

Is that correct and will it have any other effect?

Kind regards

Neil.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Displaying Images uses up PC memory

Jump to solution

Hi Neil,

You should not dispose of the image until it is no longer in use so I would recommend adding the Dispose when you close the form. The syntax would be

invoke picView::"Image"::"Dispose"()

By the way, are you aware that the quotes around the method names are no longer required in Visual COBOL ?

Hope that helps,

Gael

View solution in original post

0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Displaying Images uses up PC memory

Jump to solution

Hi Neil,

You should not dispose of the image until it is no longer in use so I would recommend adding the Dispose when you close the form. The syntax would be

invoke picView::"Image"::"Dispose"()

By the way, are you aware that the quotes around the method names are no longer required in Visual COBOL ?

Hope that helps,

Gael

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Displaying Images uses up PC memory

Jump to solution

Hi Gael,

Thats greats many thats for info and yes but there are a few reasons why I still use quotes.

Kind regards

Neil.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.