• Unity
  • Services
  • Made with Unity
  • Learn
  • 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
  • Forums
  • Answers
  • Feedback
  • Issue Tracker
  • Blog
  • Evangelists
  • User Groups

Navigation

  • Home
  • Unity
  • Industries
  • Made with Unity
  • Learn
  • Community
    • Forums
    • Answers
    • Feedback
    • Issue Tracker
    • Blog
    • Evangelists
    • User Groups
  • Get Unity
  • Asset Store

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 splash28 · Aug 12, 2011 at 11:03 PM · androidcrashdebugadb

Android app crashes after 15 mins of play. Too many open files.

Any idea on this? Any help would be greatly appreciated.

Unity 3.4 Android Basic, Galaxy S. The game is a simple one, more like a picture viewer. It has some buttons (cubes), UI elements (labels) and a very simple AI. It does have save game functionality, but only when the player advances a level.

After playing around 10-20 minutes it blinks (or not even blinks) and whoops it disappeared. (Crashed eventually.) In case of every 'death' the game was cc. idle. (I was thinking.)

adb logcat has the following not too verbose information (//comments by me)

 I/Unity   (13928): UnityEngine.Debug:Log(Object) //Debug.Log...
 I/Unity   (13928): msgAPI:setText() //setting the label of a text in msgAPI script
 I/Unity   (13928): msgAPI:FixedUpdate() //msgAPI's FixedUpdate function
 I/Unity   (13928):  
 I/Unity   (13928): (Filename: /Applications/buildAgent/work/8xxxxxxxxxxx52/Runtime/Export/Generated/UnityEngineDebug.cpp Line: 34)
 
 I/Unity   (13928):
 E/dalvikvm-gc(13928): Could not create 1196032-byte ashmem mark stack: Too many open files** 
 
 E/dalvikvm-heap(13928): dvmHeapBeginMarkStep failed; aborting
 
 E/dalvikvm(13928): VM aborting
 
 D/Zygote  ( 3172): Process 13928 terminated by signal (11)//Dies



I guess the culprit is somewhere around the "too many open files" error. But what could this mean? I only have textures loaded via the editor (ie no streaming assets). So ok maybe it's due to some parts of the program... but... I only user primitive variables, a few classes and a few built-in arrays.

Also... objects are not created in any of the Update/FixedUpdate functions, the only problem I could imagine if I created objects too fast (like in an update) and the GC couldn't deal with it.

PS.: One thing came to my mind. Is it legal to use renderer.material.SetTextureOffset("_MainTex", somethingVector2) at will? Or does it go into file reading when called?... Erm, I'm out of ideas atm.

Update: I wrote a script so my PC played the game in the Editor's Play window. The game ran w/o errors for 1 hour+. Now I'm puzzled.

Comment
Add comment · Show 5
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 Waz · Aug 14, 2011 at 12:11 AM 0
Share

If you are not opening files (including network accesses), then I'd suspect a bug in Unity that you're tripping with something novel that you are doing. If you can narrow down what you're doing, Unity would probably love to have the bug report.

Certainly changing the texture offset is not unusual, so I'd not suspect that. Does it crash if you don't actually play but just sit there idling in the game (you may need to change your game rules to test that of course)? If so, that narrows it down to just the update functions that would be executing while idling (such as your suggestion about the UV animation).

One thing I'd suspect: do you change a PlayerPrefs variable all the time? You should be allowed to of course.

avatar image Waz · Aug 14, 2011 at 12:14 AM 0
Share

Another thing I'd suspect is logging. Try to get rid of any continuous logging (you should do that anyway), to see if that fixes it.

avatar image splash28 · Aug 14, 2011 at 02:51 PM 0
Share

Thanks for the comment, I will try to eliminate the many Debug.Log calls, and no it doesn't crashes on its own (without actually playing) and no I don't change the PlayerPrefs variable at all. I will let you know what happened, thanks again.

UPDATE: It DOES crashes when leaving idle and setting the display to never sleep. Thanks for the tip, will post more updates later.

avatar image splash28 · Aug 14, 2011 at 10:56 PM 0
Share

Sigh. It looks like that leaving the game on its own even on the splashscreen level reproduces the same phenomenon.

FYI the splash screen level has like zero code. Update 2: Tested it with my test unity project, it dies after 20 mins too. Now testing it with Papertoss to see if my telly is the culprit.

avatar image splash28 · Aug 15, 2011 at 10:07 AM 0
Share

Papertoss didn't crash. It seems my phone doesn't like Unity or vica versa.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by splash28 · Aug 15, 2011 at 01:26 PM

I think I've found somewhat of an answer. It was (is) building in development mode. (Player settings.)

For some reason even the simplest project crashed on my phone IF it had something to do with textures. Ie. make a cube, put a texture on it, take a Texture2D array with around 12 textures and 'animate' it with this:

 var frames : Texture2D[];
 var framesPerSecond = 10.0;
 
 function Update () 
 {
     if (Input.GetKey(KeyCode.Escape)) Application.Quit();
     var index : int = Time.time * framesPerSecond;
     index = index % frames.Length;
     Debug.Log("index == " + index);
     renderer.material.mainTexture = frames[index];
 }

On my Galaxy S it will always crash after 15-20 minutes if you build this project w/development mode on.

Comment
Add comment · Show 4 · 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 Waz · Aug 15, 2011 at 09:58 PM 0
Share

Are you sure that isn't because of the 36000 Debug.Logs (if it gets 60 FPS)? Presumably they are a no-op in a non-dev build.

avatar image splash28 · Aug 15, 2011 at 11:35 PM 0
Share

I will test that too, ty for the tip, but since it's 2 am here, that's work for tomorrow. :)

avatar image splash28 · Aug 20, 2011 at 07:46 PM 0
Share

I've tested it and the app, compiled with one scene, with one script in it

 function Update()
 {
     if (Input.GetKey(KeyCode.Escape))
     {            
         Application.Quit();
     }
 }

dies after cc. 20 minutes if it's built with development mode. Anyway, non-dev mode was an adept workaround for me.

avatar image Waz · Aug 20, 2011 at 10:51 PM 0
Share

(If you haven't already, be sure to report to Unity)

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Invalid Indirect reference in decodeIndirectRef. VM aborting. 0 Answers

Android build crashes on launch. 2 Answers

java.lang.Error running on Android 0 Answers

Exiting video (started with Handheld.PlayFullScreenMovie) causes a crash on Kindle Fire. 1 Answer

my game is crashing when i hit play button on Android devices 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges