Should this happen?
BlitzMax Forums/BlitzMax Programming/Should this happen?
| ||
I'm using the most up to date version of Max and this is the code: SuperStrict 'Pixmap Testing Global G_WIDTH:Int = 800 Global G_HEIGHT:Int = 600 Global image:TImage = LoadImage("image.jpg") Graphics G_WIDTH,G_HEIGHT While KeyDown(KEY_ESCAPE) = False Cls DrawImage(image,0,0) DrawText(GCMemAlloced(),20,20) 'DrawText(GCCollect(),20,40) Flip Wend End Run it (using any image you have) and watch the number go up and up, at least that is what happens on my machine. Then run it again with the second draw text commented back in. Is this right? |
| ||
No problem here. The memory usage goes up for about four seconds, to about 90K. After that it hovers around 35K to 50K. |
| ||
Is that normal then? I was certain I used to get more stable and much less changable results in previous versions of BM. And why are there such different results depending on whether the second drawtext command is in? Thanks for letting me know though. |
| ||
It's as if automatic GC isn't run every cycle. This could be a good thing to help FPS as it's probably not necessary to run each cycle. When you run GCcollect it's running every cycle so keeps the figure low and stable. The second drawtext actually runs the GCCollect() to get the figure for drawtext. <Edit> P.S. you were getting a more stable figure pre-1.12 because you were using flushmem (i.e. GCCollect) each cycle. |
| ||
Ah ha. Excellent. Thank you very much tonyg. |