Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Dessouky · Sep 10, 2015 at 12:49 PM · unity 5iosmemory managementmemory-leaktextasset

iOS Possible memory leak when large TextAsset is loaded

I have a large xml file which is loaded from a TextAsset in an asset bundle, once loaded I parse the elements and use the data contained to create a database of objects with various features and parameters.

My problem here is that on iOS there is a surprisingly large memory spike when I assign the TextAsset.text to a string, or read it using a string reader. I can manage all memory increases due to the bundle itself, by unloading the bundle, unloading unused assets and destroying the text asset. but nothing I do seems to get rid of the increase created by assigning the TextAsset.Text to a string. I've added the code snippet I'm testing below.

This part works just fine, the memory used by loading the bundle request and the Text asset is released when I destroy the textasset and unload unused assets

 if (bundle.mainAsset != null)
             {
                 AssetBundleRequest request = bundle.LoadAssetAsync("data", typeof(TextAsset));

                 yield return request;
 
                 TextAsset xmlFile = request.asset as TextAsset;

The Parser.Xml is a string, I've also tried directly loading it to an XMLDoc, and using a stringReader, once it loads the text into the string, the memory goes up and will not go down no matter what I do after

                 parser.Xml = xmlFile.text;


This is more or less everything I could think of to release the memory

                 parser.Xml = null;
                 DestroyImmediate(xmlFile,true);
                 System.GC.Collect();
                 request = null;
                 bundle.Unload(true);
                 Resources.UnloadUnusedAssets();

    }

I've tried everything I could think of to get it to release the memory, not sure if its a memory leak or if I'm missing something here, I only have this issue on iOS device (profiled using instruments). Don't see any evidence of it when I profile memory in editor

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 Sohaib_techverx · Jul 17, 2020 at 05:12 PM 0
Share

Hi, I know its really old but were you able to solve this issue? I am trying Resources.UnloadAsset(myTextAsset); but it dosent work.

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

32 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

Related Questions

IOS unity taking lot of memory 0 Answers

iOS: Handheld.PlayFullScreenMovie with FullScreenMovieScalingMode as AspectFill does not scale as expected 1 Answer

how to implement SKPaymentTransactionObserver in unity 0 Answers

ios app crashes on start 0 Answers

Launch Xcode build from iOS application project. 0 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