x


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

more ▼

asked Dec 23, 2011 at 09:46 AM

Bovine gravatar image

Bovine
1.9k 83 69 121

I am also very interested in this...

Jan 26, 2012 at 09:03 PM Clement_Shimizu

Incidentally the GC.Collect() can only occur every frame if your heap size is small, mine was more like 3MB 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 3MB of headroom, so a a collect only happens by itself every 10-20 minutes. 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...

Jul 10, 2012 at 12:02 PM Bovine

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.

Oct 18, 2012 at 03:04 PM DoktorAce

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.

Oct 18, 2012 at 06:01 PM whydoidoit
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1473
x1134
x524
x272

asked: Dec 23, 2011 at 09:46 AM

Seen: 2137 times

Last Updated: Oct 18, 2012 at 06:01 PM