_WIDTH(_LOADIMAGE()) Ok?
#8
(01-13-2023, 01:45 PM)TerryRitchie Wrote: I recently saw some code that did this:

ImageWidth = _WIDTH(_LOADIMAGE("Image.png", 32))

Will this leave the image's contents in RAM with no way of freeing it?

-or-

Will the image be discarded since the handle was not assigned to a variable?

It's a neat trick and one that I could happen to use on a current project but not if the image is orphaned in RAM.

How is one going to _FREEIMAGE that?  As you suspect, chances are that's an image lost in RAM forevermore.

The only reason I say "chances are", is because image handles start at -10 and go downwards from there, so it's always possible some odd coder wrote something like:

FOR i = -10 TO -1000 STEP -1
  _FREEIMAGE i
NEXT
Reply


Messages In This Thread
_WIDTH(_LOADIMAGE()) Ok? - by TerryRitchie - 01-13-2023, 01:45 PM
RE: _WIDTH(_LOADIMAGE()) Ok? - by mnrvovrfc - 01-13-2023, 02:07 PM
RE: _WIDTH(_LOADIMAGE()) Ok? - by TerryRitchie - 01-13-2023, 03:43 PM
RE: _WIDTH(_LOADIMAGE()) Ok? - by mnrvovrfc - 01-13-2023, 02:24 PM
RE: _WIDTH(_LOADIMAGE()) Ok? - by RokCoder - 01-13-2023, 04:10 PM
RE: _WIDTH(_LOADIMAGE()) Ok? - by bplus - 01-13-2023, 04:18 PM
RE: _WIDTH(_LOADIMAGE()) Ok? - by bplus - 01-13-2023, 04:59 PM
RE: _WIDTH(_LOADIMAGE()) Ok? - by SMcNeill - 01-13-2023, 05:12 PM
RE: _WIDTH(_LOADIMAGE()) Ok? - by TerryRitchie - 01-13-2023, 08:55 PM
RE: _WIDTH(_LOADIMAGE()) Ok? - by TempodiBasic - 01-21-2023, 12:02 AM



Users browsing this thread: 2 Guest(s)