Frame rate 'stutters'

Blitz3D Forums/Blitz3D Programming/Frame rate 'stutters'

yinch(Posted 2003) [#1]
I have a game that dynamically allocates a large number of entities and type-variables. During the course of play, the entities are Freed and the type-variables are deleted.
There is a constant throughput of allocation and deallocation.

When I run the program for a slightly longer period, I experience the frame-rate dropping to nearly 1 fps for a couple of seconds and then it recovers.

However, after that first occurence, the frame rate degradation keeps repeating, alternating with periods of normal performance.

Does anyone know if some background garbage collection might be causing the slowdown? Or has anyone else come across this problem?

yinch'03


Ross C(Posted 2003) [#2]
it might be memory fragmentation. if you keep freeing and allocating memory, it will eventually get fragmented. don't think it would cause that much of a slow down tho. you should think about adding a field in your type called alive or something. then instead of deleting it just change alive=1 to alive=0, then hide the entity. no need to free any entities all the time.

works a treat for what i use it for (particle system) :D


Hotcakes(Posted 2003) [#3]
Hmmm, sound advice under normal situations, but a bit pointless where Blitz is concerned, because (as I understand it) Blitz actually does a similar thing internally. It assumes that because you've created it before, you might create it again in the future, being a repetative game and all, so doesn't actually deallocate it. So maybe it's just getting confused and not reusing some types when it should be?

If -that's- the case, then you'll want to try joker's suggestion anyway =]