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
1
Question by MileSplit · Feb 27, 2014 at 11:09 PM · errorruntimememory

OutOfMemoryException: Out of memory

Im getting this weird error whenever I run my game, a google search reveals nothing specific to unity. Does anyone know what this runtime error is or how to fix it?

EDIT im now getting it every update and when i compile my script, how do i get rid of this? there is almost no textures on the screen and i am getting ~300 fps! Thanks!

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

3 Replies

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

Answer by MileSplit · Feb 28, 2014 at 03:35 AM

My problem ended up that i had too large of an array, it was

 public Vector3[,,,] tooLargeOfAnArray = new Vector3[50,50,1000,1000];

Because of this, the compiler could not initialize it all so it told me it ran out of memory, then every time i referenced tooLargeOfAnArray it ran out of memory and told me.

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
1

Answer by Anxo · Feb 27, 2014 at 11:17 PM

If you are using a lot of textures this may happen. It might not have much to do with your actually ram but more with the limited ram it is allowed to use. In an effort to avoid this, You can dump your textures in a resources folder and load them as needed instead of having them in the scene. That allows you to dump them from memory when they are no longer in use which becomes much more memory efficient.

Resource.Load https://docs.unity3d.com/Documentation/ScriptReference/Resources.Load.html

Resource.UnloadAsset https://docs.unity3d.com/Documentation/ScriptReference/Resources.UnloadAsset.html

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 ChrisSch · Feb 27, 2014 at 11:20 PM

OutOfMemoryException error means you've ran out of your free RAM memory, and the game usually crashes. So if you have 2gb of free memory it happens when it fills up those 2gb and the game crashes cause it needs more. Like my modded Skyrim and Minecraft. xD

Does it happen in every scene (new scene) or just on the current one you're working with? Assuming its the latter, and not Unity's fault, then you have something seriously filling up your free memory. That's all I can tell you with that much info.

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 ChrisSch · Feb 27, 2014 at 11:32 PM 0
Share

Ah, yes that could be it. I'm also working on a procedural dungeon generation and have had bugs where it generates to infinity, but never had that error, it just froze up Unity after a good number of torch/chest filled dungeon rooms. xD

Probably cause I never built and ran it while it was bugged.

avatar image MileSplit · Feb 27, 2014 at 11:58 PM 0
Share

I just noticed this and i was wondering if somone could help, i get this error when i play AND once my code finishes compiling, but it doesn't stop me from playing...

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

23 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

Related Questions

m_Memory.renderTextureBytes<0 1 Answer

Where is Actually The Prefabs Stored Before Instantiation? RAM or Storage(Internal Memory) 2 Answers

[CRASH] Memory can not be "read" / "write" 1 Answer

How to access the IOS's memory usage in runtime!? 1 Answer

How to tell if a texture was generated at runtime? 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