sloopidoopi / Spout4Unity

Spout support for Unity3D
BSD 2-Clause "Simplified" License
138 stars 47 forks source link

Memory leak in CPU and GPU #11

Open ijreil opened 8 years ago

ijreil commented 8 years ago

I’m building an application where Unity would send one texture to VVVV via Spout. Working on it, I’ve noticed that every time I kill Unity player, and reopen it again (no matter how much time passed) while leaving VVVV running, there are 15 Mb more or less that always sum up to the memory.

I first thought it could be VVVV related, so been playing with fromsharedtexture node to see if I could find out anything, but I haven’t. So I’ve made some tests in a PC with AMD Radeon E8860 dedicated Graphics and Unity 5.3.4f1 version:

Looking at logs, I've seen that Awake from Spout scripts executes again after onDisable, so maybe here is the problem? A bunch of new objects is created and not liberated anymore?

What I can't understand is why, when Script is compiled there is no leak when VVVV receiver is not present and rendering.

ijreil commented 8 years ago

I've tried removing [ExecuteInEditMode] so Awake() doesn't execute again on close but the leak is still there. Also, I've tried to deactivate Spout script to see if SpoutSender could be the problem, but there isn't. So it may be the something with the Spout script.

sloopidoopi commented 8 years ago

I have to look at this but at the moment i have no time. But thanks for your testing. This alll sounds strange. Did you tested it with an older Unity Version? Perhaps Unity change the way the underlying native textures are handled.

ijreil commented 8 years ago

Sorry for the late reply, been working in another project I haven't had time to test this. Do you recommend me to downgrade to any specific version?