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 sedlu · Apr 09, 2014 at 05:42 AM · physicsmemorysimulate

Physics.simulate allocates memory each frame

With the profiler I see that each time physics.simulate is executed it causes memory allocation, even when there is nothing in the scene moving. The amount it allocates is about 1~5 KB. Is it normal?

Thanks.

Updated: Sorry for wrong amount of allocated memory. It is about 1~5 KB, not 100~150KB.

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 Benproductions1 · Apr 09, 2014 at 08:02 AM 0
Share

Physics still needs to run, even if the rigidbodies are stationary. 100~150$$anonymous$$B is really not a lot of memory, so I wouldn't worry.

avatar image sedlu · Apr 09, 2014 at 09:27 AM 0
Share

I would like to make memory allocations as few as possible thus reduce the frequency of garbage collection. If that amount of memory allocated by physics.simulate cannot be avoided, then I should focus on allocations caused by other modules. Thanks.

avatar image Benproductions1 · Apr 10, 2014 at 11:20 AM 0
Share

Have you deter$$anonymous$$ed that garbage collection is the bottleneck of your application?

If so, you must be allocating a large amount of memory. '100~150`$$anonymous$$B is a really small amount of memory, when you consider even most mobile phones now have at least 1 Gig of memory. 1~5$$anonymous$$B is absolutely nothing. Are you sure you're not just looking for optimizations without a cause? Why do you want to reduce memory allocations?

I'm pretty sure both Box2D and PhysX use manual memory management, so no actual garbage collection is run for either. The same goes for the underlying Unity engine, which is written in C++.

This means that if garbage collection is your bottleneck, it is probably in your scripts, or anything else in the mono-runtime-environment.

avatar image sedlu · Apr 11, 2014 at 09:39 AM 0
Share

Thanks for reply. I know 1~5kb is not a big large amount, but it is allocated each frame. I have eli$$anonymous$$ated or reduced almost all other allocation in each frame caused by my scrips, and the total amount allocated by them each frame is less than 1$$anonymous$$B. But there are still frame hiccups during the game play.

The project is a PS3 game, so the memory capacity is not so sufficient. Any unnecessary memory allocation each frame may cause the garbage collection happens more frequently, that's why I want to reduce them as much as possible.

Anyway, if the allocation is necessary, I will try to find other possible causes leading to the frame hiccups. There should be something I missed.

Thank you very much.

avatar image Benproductions1 · Apr 16, 2014 at 12:11 PM 0
Share

There are some pretty good threads on the same issue you are having. Following those suggestions usually solves the "hiccups". I also had this problem once, but some code-reformatting and other optimizations fixed it.

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

22 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

Related Questions

Mobile physics optimizations and Mesh Colliders 1 Answer

No APEX, what's the next best thing? 1 Answer

2D 360 degress platformer example needed 0 Answers

Simulating a tricopter 1 Answer

I got a problem with using the OverlapseSphere() method inside a different PhysicsScene 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