Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by alexnode · Sep 10, 2010 at 04:42 PM · crashmemoryonguilogmemory-leak

Application crashes after seven hours !

I have a simple application that It needs to run for 10 hours per day. Don't ask why!!! I am not a programmer so i am not really aware about what happens with memory management variables or background logs in unity. I have some gui variables like that ... there are loads more to be honest ..

var widthBorderShort = (Screen.width - (Screen.width/20))-512;
        var widthBorderLong = (Screen.width - (Screen.width/20))-975;
        var heightBorder = (Screen.height -(Screen.height/20))-64;

If i declare the variables in OnGUI and do a debug log the variables are called every frame. How unity is working if i am not using debug log? does it just replaces a few numbers every frame or it keeps a log of them? In around 7 hours the application crashes ! So i must have a memory leak or some sort of logging overflow ... Is there any way to figure out what is going on ? IT might be even a computer problem ...

The ideal would have been to put these variables in an update or onGUI and calculate screen.width ONLY when the user tries to resize. something like

   if (application.resize) 
    {
    //find my new screen/width   
//dostuff  
    }

or getting a value from awake naming it initialScreenWidth and

        if (Screen.width> intialScreenWidth){
    //declare variables 
    initialScreenWidth= Screen.width;
//do stuff 
    }

Should i worry about declaring variables OnGUI or there is no problem ... ?I am not sure where to begin really ... any suggestions?

Comment
Add comment
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

1 Reply

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

Answer by Bampf · Sep 10, 2010 at 06:46 PM

None of the lines of code you show should allocate any amount of memory that matters. They are integers, not objects, and you are allocating them in local variables in OnGUI- they go away when the method exits.

The kinds of lines you should be worried about allocate objects that don't get cleaned up. They would tend to be game objects stored in the scene (for example, if you called Instantiate) or objects added to arrays, text being appending to a string over and over again... something like that.

If you haven't already, verify that memory allocation is in fact the problem. Run your app the same way it's being run when it crashes, and monitor it (on Mac use Activity Monitor, on Windows use Task Manager.) If memory is the problem you should see the memory footprint go up significantly after half an hour. There are many reasons an application can to crash, for example, if it accesses a network or network resource that gets shut down every night.

If you have any specifics about the crash you should post them. Try reproducing with a debug build, maybe you'll get some better information from the crash.

Comment
Add comment · Show 1 · 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 alexnode · Sep 12, 2010 at 02:15 PM 0
Share

Thanks Bampf. You know, it is not nice waiting for seven hours! I will post when I find what it is. $$anonymous$$emory seems more or less the same. I don't use the network... and the instantiate is not leaking... I have to test in another computer tomorrow.

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.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

iOS crashing between scenes, memory problem? 0 Answers

How to get crash Reports that users send from Unity webplayer to Unity? 0 Answers

Android build crashes on launch. 2 Answers

Shader import error: Out of memory, but not really 0 Answers

Can I see non-Monobehavior objects in the memory profiler? 1 Answer


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