loadImage / FreeImage
Blitz3D Forums/Blitz3D Beginners Area/loadImage / FreeImage
| ||
If I run the following code, the programm will chrashes after some minutes. This code is only an example to demostrate the problem in my new game. In my new game I need very many graphics. I have to reload some graphics, because they are to many. What can I do ? Kind Regards, Dirk Knoop Graphics 1024,768,32,1 SetBuffer BackBuffer() Repeat If KeyHit(1)=1 Then End c=c+1 Cls Text 10,10,c Flip picture=LoadImage("picture.png") FreeImage picture Forever |
| ||
don't free the image till the gfx is finished with, i moved the freeimage instruction to outside the loop, same with loadimage picture=LoadImage("picture.png") Repeat c=c+1 Cls ; display stuff here - such as loaded gfx Text 10,10,c Flip Until KeyHit(1) ; simpler to have the exit check here - personal preference though FreeImage picture ;perhaps also have a check to make sure image exists before freeing it if picture <> 0 then freeimage picture |
| ||
Which version of blitz do you have? The upgrade to version 1.92/3/4/5? had problems with freeing resources (1.90/1.91 didn't and supposedly everything works with 1.96 which we are at now). |
| ||
Thank you for answering. I used V 1.94, now I updated to V1.96. I will try the code now for 15 hours. Thank you Matty! Dirk Knoop |
| ||
Dirk, aren you saying that you are going to load a picture file from your harddrive for 15 hours straight? Isn't that putting a wee bit excessive wear-and-tear on your hard drive? Granted, modern hard drives are usually rated for 100,000 hours (which is a lot more than 15). Still, it seems extravagant. |
| ||
Maybe he has a vertual Ram draive |
| ||
100000 hours are 4166 days. That means 11 years. I donīt want to use my computer for 11 years :-) It was just an extremly test. |
| ||
do you mean extremity test? because thats definitly what your code will do - 15 hours *shakes his head in disbelievement* |
| ||
Dirk, that's 11.4 years, if you use floating point ;o) You know, in 100,000 hours, I think it will be a good bet that you will be using a new computer anyway on a whole new technological level that surpasses anything in the world today. Today's best 3D graphics cards will be crude, bargain-basement, close-out junk compared to the tech of tomorrow (especially 11.4 years of tomorrows). BTW, if you don't mind my asking, how many graphics ARE you using? In your original post, you said In my new game I need very many graphics. I have to reload some graphics, because they are to many. How many is too many? |
| ||
It's a bit strange to be thrashing the harddisc like that. Come to think of it, won't the hard discs cache, store this, if it's so frequently used? |