x


what sort of thing is likely to cause my game (ran as server using -batchmode flag) to consume the entire CPU after about 8 hours of running?

I am running a version of my game using the -batchmode flag on a windows (VPS) server. It runs perfectly well for the first few hours but over a period of about 8 hours consumes my entire CPU Usage. I am not sure where to start to look for the culprit causing this.. (the 'output_log.txt' file gets quite large but surely writing to that can't be the culprit??)

any tips on the sort of thing i should be looking for in my code would be greatly appreciated

cheers andrew

more ▼

asked Apr 21 '10 at 12:11 PM

andrew gravatar image

andrew
549 10 12 18

Hi Andrew, did you find the cause of your troubles? A follow up comment might be useful for future reference. Cheers!

May 08 '10 at 04:49 PM Ricardo
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Start by checking the machine's memory usage at that point. Is it significantly higher than when you started the process? How's the pagefile usage looking?

"Surely X can't be the culprit?" are famous last words. For instance, your logging probably does a lot of string concatenation and formatting. If you're doing that sub-optimally - for instance, using the + operator instead of a stringbuilder and string.Format - the resulting allocation and destruction of strings could have an effect on Mono's less-than-ideal garbage collector (see these two articles). While StringBuilder is not always faster, it's memory fragmentation that you should care about the most.

While I'm not saying that logging is the culprit, it's a good example of things that might be non-obvious at first but where you want to start checking your memory allocation and usage patterns.

more ▼

answered Apr 22 '10 at 12:27 AM

Ricardo gravatar image

Ricardo
5.2k 20 32 96

(comments are locked)
10|3000 characters needed characters left

There is most likely a leak somewhere in your games code. I would reccommend asking on the unity forums for more help.

more ▼

answered Apr 21 '10 at 04:42 PM

KHopcraft gravatar image

KHopcraft
204 1 9

No reason why he couldn't get help finding it here, actually.

Apr 22 '10 at 12:09 AM Ricardo

I know, but the forum has a lot more traffic, and with a problem like this I just figured it would be better in the forums :o.

Apr 22 '10 at 05:32 PM KHopcraft
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5273
x492
x426
x35

asked: Apr 21 '10 at 12:11 PM

Seen: 1006 times

Last Updated: Apr 21 '10 at 12:11 PM