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 Bovine · Dec 23, 2011 at 09:46 AM · mouseperformancememoryprofiler

What is SendMouseEvents and why is it allocating memory every frame?

Hi there, I've been doing some profiling recently and in the profiler I see that SendMouseEvents.DoSendMouseEvents() is always present and allocates 76 bytes (if the mouse is not over the game window) or around 1.8K when it is. Is this a real method or is it something to do with profiling the app? I am profiling in the editor ATM.

I ask because I have been following the advice of doing a GC.Collect() every 30 frames, but contrary to the advice this is profiling as taking around 12MS (and not 5MS) and that's on the desktop, the amount of memory allocated in this time is small < 60K. Is this collection inflated in the profiler?

Thanks Bovine

Comment
Add comment · Show 4
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 Clement_Shimizu · Jan 26, 2012 at 09:03 PM 0
Share

I am also very interested in this...

avatar image Bovine · Jul 10, 2012 at 12:02 PM 0
Share

Incidentally the GC.Collect() can only occur every frame if your heap size is small, $$anonymous$$e was more like 3$$anonymous$$B and this takes a long time to collect, especially on mobile. We've taken Unity's advice and:

  1. GC.Collect() when we can - opening player's inventory; loading a level

  2. Artificially allocate on the heap to cause the heap to grow and then free that up. This gives us 3$$anonymous$$B of headroom, so a a collect only happens by itself every 10-20 $$anonymous$$utes. The player will find some item and enter the inventory in this time typically I would imagine.

We're still trying to find out what is allocating, but I've not profiled for memory leaks lately...

avatar image DoktorAce · Oct 18, 2012 at 03:04 PM 0
Share

Any news on this? I'm also seeing this in my project. It's the only thing allocating any memory while the game is running, so I'd really like to get rid of it.

avatar image whydoidoit · Oct 18, 2012 at 06:01 PM 1
Share

I chatted to someone at Unite about this - practical upshot is that it's some internal Unity thing.

Also should point out that in Unity 3 there are significant differences and inaccuracies between deep profile and ordinary profile mode when viewing memory allocations.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Stardog · Jul 26, 2018 at 03:54 AM

It seems to be an editor-only problem. It should not occur in a build.

https://forum.unity.com/threads/sendmouseevents-gc-collect-spike-issue.506963/#post-3306951

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

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

8 People are following this question.

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

Related Questions

Profiler spikes 1 Answer

Total memory allocated increases indefinately from .80GB untill crash 3 Answers

Performance going down over time 2 Answers

ManagedHeap.ReservedUnusedSize 0 Answers

Online, Possible Memory Leaks with RPC 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