Server question

Blitz3D Forums/Blitz3D Programming/Server question

Farflame(Posted 2008) [#1]
Not sure if this is important or not, but I'm currently testing out my online-football-management game, written in Blitz3D (not that there's any 3D in it) and left my server running for over two weeks recently. The test went well with no crashes, but when I came to turn off the server, it took about 30 seconds to shut down and return to the Blitz window. Just wondering if that's a problem and could become a serious problem if the server runs for longer periods?


GfK(Posted 2008) [#2]
Sounds like a memory leak.....


andy_mc(Posted 2008) [#3]
leave task manager open and keep an eye on the memory usage by the application. If it's going up and not stopping then a definite memory leak.

Did you not notice any slowness towards the end of the test or do you just have tonnes of RAM?


Vertigo(Posted 2008) [#4]
Blitz3d will always render/redraw the windows. Especially for server reasons you need to hide this. Blitz doesnt have a normal "console" window, so everything is using the direct draw frame. I suggest using Kev's wonderful winblitz3d library and hiding the runtime window. Should you need access to anything besides logs you can always have a winblitz3d gui up or access it with a remote client management type setup. Also you can use the SC command and create a new service that runs this executable regardless of a user login. Im not sure how youre setting this up now if its dedicated or not, but its handy when you have limited terminal service cals :)


Farflame(Posted 2008) [#5]
It does feel like a memory leak yes. There's only 1gb in the PC, so it's not exactly loads. I'll keep an eye on the memory usage and see what happens.

If it is a memory leak, what causes that and what's the solution?


NewtSoup(Posted 2008) [#6]
Memory Leaks can come in 2 types -

1) the type described above where the memory for the process keeps increasing and doesn't stop. This can be caused by objects being continually created but not used or deleted. Check for unused Custom Types not being disposed of properly.

2) The second type is not fixable from a programming within blitz point of view, memory is released by the bcc or the blitz application but remains tagged as "in use". The win32 memory manager then skips over it because it's in use but it has no process assigned to it. The used memory does not appear in the task manager information as it is essentially "lost" or truly leaked away. This results in overall system slowness for no apparent reason and requires a full reboot to clear. (Everquest 2 used to do this to me, resulting in me rebooting every hour - fixed now though). If your system runs speedily after shutting your server down then your problem isn't this.

There is another reason that your system could be slow to shut down. The memory manager truly loves to page as much out to disk as possible. So if your server activity has been low, or concentrated in just a few aspects of the game then the low usage data will be stuffed into you pagefile.sys If the server has been idle for a week then probably the entire process memory, bar enough to keep the thing ticking, has been stuffed away. The reason you get slowness when shutting down is it needs to pull all that data back from the disk in order to free up the memory properly when shutting down.


Farflame(Posted 2008) [#7]
Hmm, the server activity is very low at the moment since I only have a handful of testers. It can sometimes go for days without any activity, so maybe it's that.

Regarding custom types, I've been quite careful to delete these as I go along, to the point that with the most commonly used ones I have the number displayed on the screen every frame to make sure there are none lingering in memory..... but maybe I need to check the lesser used ones aswell, as this only occured after a couple of weeks usage.