set some images to null

Monkey Forums/Monkey Beginners/set some images to null

hub(Posted 2015) [#1]
Hi !

target = Android device

(pseudo code)

I load 10 images into MyImage:Image[10]

(step1)
for i=1 to 10
MyImage[i] = load ("image" + i + ".jpg")
next

next into my code i free them to save some memory !

Thanks !

(step2)
for i=1 to 10
MyImage[i] = null
next

and reload again... but just 5 new images.

(step3)
for i=1 to 5
MyImage[i] = load ("other_image" + i + ".jpg")
next

Do you think that i've really free 'memory' at step 2 : the MyImage [6] to MyImage[10] ?


Xaron(Posted 2015) [#2]
No, probably not. To really free them call

MyImage[i].Discard()


hub(Posted 2015) [#3]
Perfect !
Many thanks.