Closed OndrejPetrzilka closed 10 years ago
From what I see in the code - freeing the memory was intentionally commented out. Can you please post a sample project that reproduces the issue so I can debug and fix it?
As far as I can see the out commented code calls FreeHGlobal twice for VolumeCurvePointer.
As far as I can see the out commented code calls FreeHGlobal twice for VolumeCurvePointer.
Good catch! That explains the comment about double deallocation...
Sorry for late response, the commit above should fix the issue. Please let me know if this helps.
We have rewritten the code to use custom-made wrapper, because issue was critical. We won't be probably going to rewrite it back.
We won't be probably going to rewrite it back.
Not sure to understand your comment? What do you need to rewrite?
When memory leak was found, it was critical issue, so PInvoke wrapper was made for X3DAudio. Whole engine now uses SharpDX except X3DAudio.
We won't replace this PInvoke wrapper anytime soon, because it would require additional testing etc...so I cannot really test the fix. Btw, it's game 'Space Engineers'.
oh, no problem. Yep, I know your project. ;)
internal unsafe void MarshalTo(ref Emitter.Native @ref) makes allocations using Marshal.AllocHGlobal, but this memory is never released, not even in __MarshalFree
It occurs when calling X3DAudio.Calculate and any curve (VolumeCurve, LFECurve or other) is set on Emitter