strange problem, possible memory related?

BlitzMax Forums/BlitzMax Programming/strange problem, possible memory related?

jkrankie(Posted 2010) [#1]
Hi,

I've found a weird thing happens in my game. i also found a solution, but i'm not sure why it's a solution.

Basically, i noticed that if i played so many levels, the game would bog down and run at half speed for no reason. There are no memory leaks or anything else happening, so i wondered at first whether it was a graphics memory problem. But, I also noticed that this only happened the first time to started a new game, the second time i played (without quitting the game to the desktop) there was no slowdown at all and the game ran fine.

if i create a new game object and instantly null before the menu appears, the problem of it slowing down first time disappears completely.

so i'm wondering why this might be? My guess is that the game isn't allocating enough memory to itself the first time it runs, but i've really go no idea. Creating a new game object does nothing other than just return a new object, which i null immediately.

Anyone know why this might be?

Cheers
Charlie


GfK(Posted 2010) [#2]
Are you using DX9?

There's a known issue in v1.41 where Blitzmax (or DX - I forget) isn't cleaning up after itself properly. I think it originally manifested itself during repeated resolution changes causing an eventual crash. Your problem might be somehow related.

Have a search of the forum - I'm sure there was a temporary fix posted and a permanent solution is apparently coming in 1.42 (whenever that is).

[edit] Some light reading

Last edited 2010


jkrankie(Posted 2010) [#3]
Not DX, i'm currently using Max v1.30 with Minib3d. I suppose i could try a newer version, but i've had trouble with more recent versions and Minib3d in the past.

Cheers
Charlie


ima747(Posted 2010) [#4]
Could be a driver issue, lots of commercial games have a similar problem on some systems... I would recommend updating everything and see what changes.


Czar Flavius(Posted 2010) [#5]
How do you know there are no memory leaks? They're famous last words. I've found BlitzMax garbage collection can lure you into a false sense of security. Make a global counter for each important type you can be bothered to keep track of, and increase it by 1 in New() and decrease it by 1 in Delete(), and print it to the screen. This is the only way to know for sure if you have a memory leak or not.


jkrankie(Posted 2010) [#6]
@Czar: That's what i've done.

The weird bit is that it runs fine the second game.

Cheers
Charlie