New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[X3DAudio] Memory leaks in SharpDX.X3DAudio.Emitter.__MarshalTo #393

Closed
OndrejPetrzilka opened this Issue May 21, 2014 · 8 comments

Comments

Projects
None yet
4 participants
@OndrejPetrzilka
Contributor

OndrejPetrzilka commented May 21, 2014

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

@ArtiomCiumac

This comment has been minimized.

Contributor

ArtiomCiumac commented May 28, 2014

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?

@filoe

This comment has been minimized.

filoe commented Jul 11, 2014

As far as I can see the out commented code calls FreeHGlobal twice for VolumeCurvePointer.

@xoofx

This comment has been minimized.

Member

xoofx commented Jul 13, 2014

As far as I can see the out commented code calls FreeHGlobal twice for VolumeCurvePointer.

Good catch! That explains the comment about double deallocation...

@ArtiomCiumac

This comment has been minimized.

Contributor

ArtiomCiumac commented Jul 17, 2014

Sorry for late response, the commit above should fix the issue.
Please let me know if this helps.

@OndrejPetrzilka

This comment has been minimized.

Contributor

OndrejPetrzilka commented Sep 8, 2014

We have rewritten the code to use custom-made wrapper, because issue was critical. We won't be probably going to rewrite it back.

@xoofx

This comment has been minimized.

Member

xoofx commented Sep 9, 2014

We won't be probably going to rewrite it back.

Not sure to understand your comment? What do you need to rewrite?

@OndrejPetrzilka

This comment has been minimized.

Contributor

OndrejPetrzilka commented Sep 10, 2014

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'.

@xoofx

This comment has been minimized.

Member

xoofx commented Sep 10, 2014

oh, no problem. Yep, I know your project. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment