• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by andrew · Apr 21, 2010 at 12:11 PM · optimizationserverbatchmode

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

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ricardo · May 08, 2010 at 04:49 PM 0
Share

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

2 Replies

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by Ricardo · Apr 22, 2010 at 12:27 AM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by KHopcraft · Apr 21, 2010 at 04:42 PM

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

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ricardo · Apr 22, 2010 at 12:09 AM 0
Share

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

avatar image KHopcraft · Apr 22, 2010 at 05:32 PM 0
Share

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.

Your answer

Hint: You can notify a user about this post by typing @username

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

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Optimizing Headless Servers 2 Answers

Reducing server-side application size 0 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Can someone help me fix my Javascript for Flickering Light? 6 Answers

How to tell if the game is running in batchmode? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges