Friday, October 14, 2011

Memory leak

Somewhat related to AI bug, I noticed that if I keep playing the game long enough it gets slow.. and  I mean really slow. Usually it runs on 30fps ( limited ) and when using walkmode it almost never goes down to 28 even with 30+ npc and 15+ light sources. However after playing a bit it became so slow that when doing nothing, just letting visual rendering do its stuff, it ran on 30fps but as soon as player moves one square it downed fps to 5 fps or even 1 fps.. and it took several second to recover.

The problem was memory leak in fov stuff of lightsources and npcs. When it started to jam the game was hauling around 1GB of memory and increasing the memory consumption by 30MB/pc move. I solved the problem by using fovs copy method instead of recreating the fov object everytime.. Stupid mistake and it took a while to figure it out but now I know better :)

1 comment:

  1. Hey Peiha.

    You still working on this game? Was really looking forward to seeing your progress, but there's been no news of late...

    ReplyDelete