Slowing down as time goes on?

Blitz3D Forums/Blitz3D Programming/Slowing down as time goes on?

mrtricks(Posted 2005) [#1]
My game involves lots of custom meshes. They get built, they get deformed, they get freed and rebuilt, they get freed and rebuilt and so on. I've started to notice that as time goes on when playing, rendering gets slower and slower, as does mesh manipulation. I am using FreeEntity on each mesh as it gets deleted, so why this slowdown? Surely this isn't congenital to B3D when using custom meshes? If it is, I may as well throw away 3 years of work. Someone reassure me I'm missing a memory leak in my own code...


IPete2(Posted 2005) [#2]
mrtricks,

you must be - are you loading any sounds? are you freeing them - or pivots or well it must be something in there.

Take out all the creating new meshes code and run it again. Youll soon know if its in there.

Good luck dude!

IPete2.


mrtricks(Posted 2005) [#3]
The mesh code comprises most of the program :) it's a geo-mod system. So the rendering shouldn't slow down, no matter how many times I create a mesh, add to it, deform it and free it?

[edit] I just tried using AvailVidMem() to determine if I was leaking memory but it only tells me about texture memory used. When I first build the mesh it uses so much memory, then every mesh built subsequently doesn't use any more memory (they share a brush). How do I get System Memory? And in fact, if I were not freeing meshes, would that be system memory or something else?


Clarks(Posted 2005) [#4]
well are you creating any new types on the fly and forgetting to delete them


slenkar(Posted 2005) [#5]
are you using debuglog?


mrtricks(Posted 2005) [#6]
Debuglog? I'm using debug mode... is debuglog on a proprietary IDE?

Clarks - I *do* know about some types I'm not deleting, but it amounts to about 20 instances, with a few variables as fields, and no meshes are attached to them, so I can't see that any slowdown could be attributed to that. I suspect that cleaning that up would not improve the situation. (But I'll try)


Andy(Posted 2005) [#7]
>Debuglog? I'm using debug mode... is debuglog on a
>proprietary IDE?

http://www.blitzbasic.com/b3ddocs/command.php?name=DebugLog&ref=2d_a-z

>Surely this isn't congenital to B3D when using custom
>meshes? If it is, I may as well throw away 3 years of
>work. Someone reassure me I'm missing a memory leak in my
>own code...

It's propably a memory leak in your own code:)

Andy


slenkar(Posted 2005) [#8]
whenever my game slows down its always my fault


Rook Zimbabwe(Posted 2005) [#9]
You need to be able to see tris rendered on screen to see how many tris you render... I had to do this to fix my game. I would hideentity but not clearworld() or freeentity() and once I cleaned house the game ran like a top...

Of course I wanted it to run like a choo choo train but that is another matter!

Clean house... :)
Rook


mrtricks(Posted 2005) [#10]
Thanks Andy, never saw that command before. Will definitely use that.

I'm glad to hear it should be my fault - I'll have a big spring clean (although I was sure there were no leaks!)


John Pickford(Posted 2005) [#11]
I wrote my own version of debuglog which spits the messages out to a file. Helpful and it works outside of debugmode.


Function debuglog2 (message$)

	If debug_file

		WriteLine debug_file,message$
	
		DebugLog (message$)

	EndIf


End Function


debug_file, obviously, is the handle to the text file which is opened at the start of execution

	If debug_enable=1 Then debug_file=WriteFile ("config\debug.txt") Else debug_file=0


If a tester has a problem, they can just email me the file.


Rob Farley(Posted 2005) [#12]
Should there not be a line at the end:

If debug_enable=1 Then closefile(debug_file)


mrtricks(Posted 2005) [#13]
Just found the culprit. It wasn't any of my geomod code but some ancient rocket code I stuck in just to test out the geomod system - the rockets weren't deleting! Phew! Thanks for the help guys.


John Pickford(Posted 2005) [#14]
>Should there not be a line at the end:

>If debug_enable=1 Then closefile(debug_file)
Yes. But I tend to exit by closing the window so it's a bit academic. Seems to work fine.