That's puzzling. I thought that it might possibly have something to do with freeing the images in a different order than they were created. However, modifying your test routine to load four images then delete them in a different order deallocated memory as it should. I also tried putting in the MaskImage and RotateImage commands for each in case they were to blame, but deallocation worked as it should have again.
You don't do this in the test routine, but in your actual program, you aren't by chance comparing available video memory before setting the graphics mode with afterwards, are you?
That results in a "loss" of memory due to setting up buffers. Just grasping at straws... :)
Hmm, that doesn't sound quite right. You might try adding DebugLog statements every time you delete an image, just to make sure that FreeImage is really being called. For example:
To save lots of typing, this could be done in a function. Oh, and maybe having a Global count of total images currently loaded (similar to your test program) and decrementing it when an image is freed could be helpful (in case you're already using DebugLog for other things and it'd be hard to read through all the text).
You don't do this in the test routine, but in your actual program, you aren't by chance comparing available video memory before setting the graphics mode with afterwards, are you?
firstvidmem=AvailVidMem() Graphics 800,600 vidmem=AvailVidMem() Print firstvidmem+", "+vidmem WaitKey End
That results in a "loss" of memory due to setting up buffers. Just grasping at straws... :)
all the images come up as 0. I can't find a single one that doesn't come up as 0 - even the ones that I've loaded and not deleted!
Hmm, that doesn't sound quite right. You might try adding DebugLog statements every time you delete an image, just to make sure that FreeImage is really being called. For example:
If scythedl2<>0 Then FreeImage scythedl2 : scythedl2=0 DebugLog "Freed scythedl2" else DebugLog "scythedl2 not freed" endif
To save lots of typing, this could be done in a function. Oh, and maybe having a Global count of total images currently loaded (similar to your test program) and decrementing it when an image is freed could be helpful (in case you're already using DebugLog for other things and it'd be hard to read through all the text).