11-11-2022, 03:18 PM
Your program is doomed to fail. It's gonna crash and burn horribly after being used for a while. Just watch it's memory usage go up, up, up, up, and up more, in task manager.
You're endlessly loading resources -- fonts at various sizes, in this example -- and never freeing them. You've got a memory leak at work here that will eventually either crash your program, or else make your OS slow down to a crawl and become unstable.
My advice? Since your fontsize is going from 9 to 31, just load the font into an array at startup and use that array without having to worry about ever freeing or loading resources after that.
DIM font(9 TO 31) As Long
For I = 9 TO 31 STEP 2
font(i) = _LOADFONT(fontpath$, i, fontstyle$)
NEXT
Then just call your _FONT font(fontsize). No endless loading of resources necessary, nor any need to free them.
You're endlessly loading resources -- fonts at various sizes, in this example -- and never freeing them. You've got a memory leak at work here that will eventually either crash your program, or else make your OS slow down to a crawl and become unstable.
My advice? Since your fontsize is going from 9 to 31, just load the font into an array at startup and use that array without having to worry about ever freeing or loading resources after that.
DIM font(9 TO 31) As Long
For I = 9 TO 31 STEP 2
font(i) = _LOADFONT(fontpath$, i, fontstyle$)
NEXT
Then just call your _FONT font(fontsize). No endless loading of resources necessary, nor any need to free them.