Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
When to free an image?
#1
When is it a good idea to use _freeimage to clean up an image from memory?

The obvious answer is of course... when you are done with it. 
But is it necessary at programs end to clean up the image handles if they were declared in the main program or only in subroutines?

Code: (Select All)
dim shared image1 as long
dim shared image2 as long
screen _newimage (640,400,32)
_fullscreen

image1= _LoadImage("Data\im_1.png") 

_putimage (0,0)-(639,399),image1
LOADTWO
_putimage (0,0)-(339,3199),image2
'should either of these two lines be used (without being commented out)
'_freeimgae image1
'_freeimage image2
end

sub loadtwo
image1= _LoadImage("Data\im_2.png")
end sub
Reply


Messages In This Thread
When to free an image? - by James D Jarvis - 04-13-2023, 02:54 PM
RE: When to free an image? - by TerryRitchie - 04-13-2023, 03:28 PM
RE: When to free an image? - by SMcNeill - 04-13-2023, 05:02 PM
RE: When to free an image? - by James D Jarvis - 04-13-2023, 05:45 PM
RE: When to free an image? - by mnrvovrfc - 04-13-2023, 06:26 PM
RE: When to free an image? - by OldMoses - 04-16-2023, 08:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  graceful way to test for a valid image handle such as before doing _FreeImage? madscijr 7 1,018 11-11-2025, 03:50 PM
Last Post: madscijr
  A strange experience with forum posting an image TempodiBasic 2 523 06-17-2025, 06:01 AM
Last Post: TempodiBasic
  QB64PE programming challenge? auto-convert image to photoreal etch-a-sketch drawing madscijr 9 1,826 02-14-2025, 05:49 PM
Last Post: madscijr
Rainbow Kenney Game Assets All-in-1 Free Day - on itch.io - not spam grymmjack 17 4,607 09-21-2023, 08:34 PM
Last Post: James D Jarvis
  Fastest image refresh TerryRitchie 2 823 03-06-2023, 11:18 PM
Last Post: TerryRitchie

Forum Jump:


Users browsing this thread: 1 Guest(s)