What you call END, what does BlitzMax do?

Archives Forums/BlitzMax Bug Reports/What you call END, what does BlitzMax do?

sswift(Posted 2009) [#1]
Internally I mean.

Because I still get delays in my game when toggling between fullscreen and windowed mode the first time, and when exiting the game.

I can minimize the window, and then end the game, and that gets the user back to the desktop quickly, but it still takes a few seconds for the application to actually shut down.

I'm thinking the two delays are related.

And before you ask, no I cannot reproduce this. I've tried. But my app is very large and complex, and I have no idea what aspect of it might be causing the issue. It could be anything from drawing 50 images when loading them without doing a flip to buffer them in video ram, to adding and removing hundreds of items in a linked list causing some kind of internal pointer wonkiness. Without knowing what sort of cleanup END is doing internally, I can't even begin to guess at what the problem could be, and how to work around it.

All I do know is it can't be a bug in my code, because the game is running fine right up until I call end, at which point my code is no longer running, and could not be causing the delay.

[edit]

I thought of something else I do in my code which could potentially cause some kind of problem. My code does a lot of recursion. Specifically, my sprite system has a parent/child system, and the code which calculates the various transformations from one space to another makes use of recursion to do those calculations. Perhaps this mucks with the memory cleanup module in some way?


Ked(Posted 2009) [#2]
This "problem" is usually fixed for me when I free everything myself.


_Skully(Posted 2009) [#3]
Could it be the garbage collector catching up prior to exit then?


Mark Tiffany(Posted 2009) [#4]
Probably. If you got rid of that delay at the end by forcing everything to be freed yourself as you go, you'd probably just end up spreading that 2 second delay across the whole app.

Probably fairly easy to check I guess - can you do something at the end of your app just before End to ensure all /most references are freed, force the GC to free, then throw up a Notify, just to check?