Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by ChazAshley1 · Nov 30, 2015 at 02:26 PM · unity 5iosxcoderesources.load

iOS simulator, error when load resource

Hello. I have simple app which looks like a comics. It just loads and shows images. There is around 300 images. When I left only first ten images - app runs and works nicely in iOS simulator, but when I built app with all of images - it crashes when trying to load images above second image, i mean third, fourth image and so on. Here is code of the method in which I try to load images and which gives the crash.

 public void LoadResources(App app)
     {
         Debug.Log("start load resources");
         try {

             BGArt = (Sprite)Resources.Load(app.model.pathTrialImages + BackgroundArt, typeof(Sprite));
             FAArt = (Sprite)Resources.Load(app.model.pathTrialImages + ForeAddedArt, typeof(Sprite));

             Debug.Log(app.model.pathTrialImages + BackgroundArt + "  " + BGArt);
             Debug.Log(app.model.pathTrialImages + ForeAddedArt + "  " + FAArt + "\n");

             bgAmbientLoop = (AudioClip)Resources.Load(app.model.pathTrialMusic + BGAmbientLoop, typeof(AudioClip));
             if (BGAmbientLoop != "previous kept" && !string.IsNullOrEmpty(BGAmbientLoop) && !bgAmbientLoop)
                 bgAmbientLoop = app.model.tempAudio;

             bgMusicLoop = (AudioClip)Resources.Load(app.model.pathTrialMusic + BGMusicLoop, typeof(AudioClip));
             if (!string.IsNullOrEmpty(BGMusicLoop) && !bgMusicLoop)
                 bgMusicLoop = app.model.tempAudio;

             bgVoiceLoop = (AudioClip)Resources.Load(app.model.pathTrialMusic + BGVoiceLoop, typeof(AudioClip));
             if (!string.IsNullOrEmpty(BGVoiceLoop) && !bgVoiceLoop)
                 bgVoiceLoop = app.model.tempAudio;

             vfxSound = (AudioClip)Resources.Load(app.model.pathTrialMusic + VFXSound, typeof(AudioClip));
             if (!string.IsNullOrEmpty(VFXSound) && !vfxSound)
                 vfxSound = app.model.tempAudio;

             musicSound = (AudioClip)Resources.Load(app.model.pathTrialMusic + MusicSound, typeof(AudioClip));
             if (!string.IsNullOrEmpty(MusicSound) && !musicSound)
                 musicSound = app.model.tempAudio;

             voiceSound = (AudioClip)Resources.Load(app.model.pathTrialMusic + VoiceSound, typeof(AudioClip));
             if (!string.IsNullOrEmpty(VoiceSound) && !voiceSound)
                 voiceSound = app.model.tempAudio;
         }
         catch(System.Exception e)
         {
             Debug.Log(e.Message);
         }
     }

And here is the last part of XCODE's log, when it gives me the error

 start load resources
 UnityEngine.Debug:Internal_Log(Int32, String, Object)
 UnityEngine.Debug:Log(Object)
 PageModel:LoadResources(App)
 FoGModel:LoadPages(Int32)
 FoGController:OnNotification(FoGNotification, Object, Object[])
 App:Notify(FoGNotification, Object, Object[])
 ButtonView:OnPointerClick(PointerEventData)
 UnityEngine.UI.Slider:UnityEngine.UI.ICanvasElement.get_transform()
 UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData)
 PageView:OnDestroy()
 UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
 UnityEngine.EventSystems.TouchInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
 UnityEngine.EventSystems.TouchInputModule:ProcessTouchEvents()
 UnityEngine.EventSystems.TouchInputModule:Process()
 PageView:OnDestroy()
 UnityEngine.EventSystems.EventSystem:Update()
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
  
 (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
 
 The file '/Users/admin/Library/Developer/CoreSimulator/Devices/0FD32B7D-323C-440F-A578-66D553AD4B97/data/Containers/Bundle/Application/EE7E8A00-DA77-4DFE-B23A-5365B98D3335/TheFallOfGyes.app/Data/resources.assets' is corrupted! Remove it and launch unity again!
 [Position out of bounds!]
 UnityEngine.Resources:Load(String, Type)
 PageModel:LoadResources(App)
 FoGModel:LoadPages(Int32)
 FoGController:OnNotification(FoGNotification, Object, Object[])
 App:Notify(FoGNotification, Object, Object[])
 ButtonView:OnPointerClick(PointerEventData)
 UnityEngine.UI.Slider:UnityEngine.UI.ICanvasElement.get_transform()
 UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData)
 PageView:OnDestroy()
 UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
 UnityEngine.EventSystems.TouchInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
 UnityEngine.EventSystems.TouchInputModule:ProcessTouchEvents()
 UnityEngine.EventSystems.TouchInputModule:Process()
 PageView:OnDestroy()
 UnityEngine.EventSystems.EventSystem:Update()
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 
 [/Users/builduser/buildslave/unity/build/Runtime/Serialize/SerializationCaching/CachedReader.cpp line 235] 
 (Filename: /Users/builduser/buildslave/unity/build/Runtime/Serialize/SerializationCaching/CachedReader.cpp Line: 235)
 
 The file '/Users/admin/Library/Developer/CoreSimulator/Devices/0FD32B7D-323C-440F-A578-66D553AD4B97/data/Containers/Bundle/Application/EE7E8A00-DA77-4DFE-B23A-5365B98D3335/TheFallOfGyes.app/Data/resources.assets' is corrupted! Remove it and launch unity again!
 [Position out of bounds!]
 UnityEngine.Resources:Load(String, Type)
 PageModel:LoadResources(App)
 FoGModel:LoadPages(Int32)
 FoGController:OnNotification(FoGNotification, Object, Object[])
 App:Notify(FoGNotification, Object, Object[])
 ButtonView:OnPointerClick(PointerEventData)
 UnityEngine.UI.Slider:UnityEngine.UI.ICanvasElement.get_transform()
 UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData)
 PageView:OnDestroy()
 UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
 UnityEngine.EventSystems.TouchInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
 UnityEngine.EventSystems.TouchInputModule:ProcessTouchEvents()
 UnityEngine.EventSystems.TouchInputModule:Process()
 PageView:OnDestroy()
 UnityEngine.EventSystems.EventSystem:Update()
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 
 [/Users/builduser/buildslave/unity/build/Runtime/Serialize/SerializationCaching/CachedReader.cpp line 241] 
 (Filename: /Users/builduser/buildslave/unity/build/Runtime/Serialize/SerializationCaching/CachedReader.cpp Line: 241)
 
 TheFallOfGyes(885,0x7da11d4) malloc: *** mach_vm_map(size=1597460480) failed (error code=3)
 *** error: can't allocate region
 *** set a breakpoint in malloc_error_break to debug
 Could not allocate memory: System out of memory!
 Trying to allocate: 1597459332B with 16 alignment. MemoryLabel: NewDelete
 Allocation happend at: Line:0 in Overloaded New
 Memory overview
 
 [ ALLOC_DEFAULT ] used: 6801894B | peak: 730920497B | reserved: 6945359B 
 [ ALLOC_TEMP_JOB ] used: 0B | peak: 0B | reserved: 524288B 
 [ IOS new_delete ] used: 0B | peak: 0B | reserved: 0B 
 [ ALLOC_GAMEOBJECT ] used: 190449B | peak: 190449B | reserved: 222019B 
 [ ALLOC_GFX ] used: 79052B | peak: 33760092B | reserved: 83497B 
 [ ALLOC_PROFILER ] used: 17484B | peak: 18076B | reserved: 53184B 
 Could not allocate memory: System out of memory!
 Trying to allocate: 1597459332B with 16 alignment. MemoryLabel: NewDelete
 Allocation happend at: Line:0 in Overloaded New
 Memory overview
 
 [ ALLOC_DEFAULT ] used: 6801894B | peak: 730920497B | reserved: 6945359B 
 [ ALLOC_TEMP_JOB ] used: 0B | peak: 0B | reserved: 524288B 
 [ IOS new_delete ] used: 0B | peak: 0B | reserved: 0B 
 [ ALLOC_GAMEOBJECT ] used: 190449B | peak: 190449B | reserved: 222019B 
 [ ALLOC_GFX ] used: 79052B | peak: 33760092B | reserved: 83497B 
 [ ALLOC_PROFILER ] used: 17484B | peak: 18076B | reserved: 53184B 
 
 UnityEngine.Resources:Load(String, Type)
 PageModel:LoadResources(App)
 FoGModel:LoadPages(Int32)
 FoGController:OnNotification(FoGNotification, Object, Object[])
 App:Notify(FoGNotification, Object, Object[])
 ButtonView:OnPointerClick(PointerEventData)
 UnityEngine.UI.Slider:UnityEngine.UI.ICanvasElement.get_transform()
 UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData)
 PageView:OnDestroy()
 UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
 UnityEngine.EventSystems.TouchInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
 UnityEngine.EventSystems.TouchInputModule:ProcessTouchEvents()
 UnityEngine.EventSystems.TouchInputModule:Process()
 PageView:OnDestroy()
 UnityEngine.EventSystems.EventSystem:Update()
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 Mono.Security.Protocol.Tls.SslStreamBase:OnLocalPrivateKeySelection(X509Certificate, String)
 
 [/Users/builduser/buildslave/unity/build/Runtime/Allocator/MemoryManager.cpp line 980] 
 (Filename: /Users/builduser/buildslave/unity/build/Runtime/Allocator/MemoryManager.cpp Line: 980)
 
 (lldb) 

Does some one know why it occures or how to fix it? UPD: by the way, it loads only images from current chapter. It means that if I have 300 images and in first chapter there are only 10 images then it will loads only 10 images. And I have already done with an experiment - i have left images only for first 14 chapters (124 images) and the app works good...

Comment
Add comment · Show 2
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 taxvi · Nov 30, 2015 at 03:20 PM 0
Share

I think you need to remove the previous picture from the memory when you move to the next picture. Call Resources.UnloadAsset() .

avatar image ChazAshley1 taxvi · Nov 30, 2015 at 05:05 PM 0
Share

i rewrote the code with Resources.UnloadAsset() after each Resources.Load() but it does not help

0 Replies

· Add your reply
  • Sort: 

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

40 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Monetization breaks iOS build in XCode. Also breaks Android build. 1 Answer

How to add shadows for multiple 3D models in native arkit ios 0 Answers

[Not Answered] Fog not working iOS Build 2 Answers

ios app crashes on start 0 Answers

iOs build fails on 5.3 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