[Gambas-user] Memory leak...

Wolfgang dl7nb at ...17...
Tue Jan 7 11:45:26 CET 2014


Hello all,

I am using Gambas 3.5.1 on a Ubuntu 12.04.3 LTS system with 2Gb of RAM.

I made a short example to show my problem. Not a very useful code, but 
it shows my problem!

In the form I habe a Button called "ButtonStart" and a Picturebox1.

Here is the code:

Public Img As New Image

Public Sub ButtonStart_Click()
    Img.Clear
    Img = Image.Load("data/img.png")
    PictureBox1.Picture = Img.picture
End

Every time I click the button an image is loaded (Size is app. 465kB) 
and it is shown in the Picturebox1.
That is working fine, but for this image of 465Kb Gambas needs app. 1.3Mb.
I could easily live with that, but when I click again I could get nuts:

Img.clear "Clears the image". That should implement that the memory in 
no longer allocated and released! But it does not work as I expect. (??)

And thus the memory is very soon gone and the program crashes!


How can I release the memory???

I tired this problem with "Picture" instead of "Image". Even 
Picture.flush brought the same results.

Of course I have used Google already. What I found was that the problem 
is/was known and solved.

What am I doing wrong??????

Thank you for reading!

Wolfgang




More information about the User mailing list