Try this code (obviously replace the image path with a valid one):
I get this output:
17662
18370
18198
I have two questions:
1) Why doesn't it revert back to the original figure when pic = null is used.
2) When the picture is loaded in how come the memory allocation doesn't go up hugely, like by around 2Mb (for 800x600x32bit). I guess the mem allocated is just showing memory for variables etc not actual media used.
In fact to prove point 2 I used Task Manager to show the mem used before and after the image was loaded and freed. I used this code:
Basically run that and run task manager. With no image loaded it takes up about 5.5MB. Then press escape, and it'll load the image (goes up to abou 7.5Mb), the press escape again and it drops down to 5.5Mb again. GOOD.
But is there no way to show this "True" amount of memory allocated within BMax rather than having to use Task Manager, it would be great for debugging. Perhaps it's a simple API call...
Also totally weirdly, in the full screen version, the memory use within BMax goes UP now down, look:
38526
40230
41334
Explain that!
Strict GCCollect() Print GCMemAlloced() Local pic:TImage = LoadImage("C:\BlitzMax\Jake\HolidayBonus\Data\Graphics\title.jpg") GCCollect() Print GCMemAlloced() pic = Null GCCollect() Print GCMemAlloced()
I get this output:
17662
18370
18198
I have two questions:
1) Why doesn't it revert back to the original figure when pic = null is used.
2) When the picture is loaded in how come the memory allocation doesn't go up hugely, like by around 2Mb (for 800x600x32bit). I guess the mem allocated is just showing memory for variables etc not actual media used.
In fact to prove point 2 I used Task Manager to show the mem used before and after the image was loaded and freed. I used this code:
Strict Graphics 800,600,0 GCCollect() Print GCMemAlloced() While Not KeyHit(key_escape) Cls DrawText("Fresh",0,0) Flip Wend Local pic:TImage = LoadImage("C:\BlitzMax\Jake\HolidayBonus\Data\Graphics\title.jpg") GCCollect() Print GCMemAlloced() While Not KeyHit(key_escape) Cls DrawText("Loaded",0,0) Flip Wend pic = Null GCCollect() Print GCMemAlloced() While Not KeyHit(key_escape) Cls DrawText("Freed",0,0) Flip Wend
Basically run that and run task manager. With no image loaded it takes up about 5.5MB. Then press escape, and it'll load the image (goes up to abou 7.5Mb), the press escape again and it drops down to 5.5Mb again. GOOD.
But is there no way to show this "True" amount of memory allocated within BMax rather than having to use Task Manager, it would be great for debugging. Perhaps it's a simple API call...
Also totally weirdly, in the full screen version, the memory use within BMax goes UP now down, look:
38526
40230
41334
Explain that!