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

Show comment
Hide comment
@ArtiomCiumac

ArtiomCiumac May 28, 2014

Contributor

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?

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.

Show comment
Hide comment
@filoe

filoe Jul 11, 2014

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

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.

Show comment
Hide comment
@xoofx

xoofx Jul 13, 2014

Member

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

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

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.

Show comment
Hide comment
@ArtiomCiumac

ArtiomCiumac Jul 17, 2014

Contributor

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

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.

Show comment
Hide comment
@OndrejPetrzilka

OndrejPetrzilka Sep 8, 2014

Contributor

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

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.

Show comment
Hide comment
@xoofx

xoofx Sep 9, 2014

Member

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

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

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.

Show comment
Hide comment
@OndrejPetrzilka

OndrejPetrzilka Sep 10, 2014

Contributor

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

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.

Show comment
Hide comment
@xoofx

xoofx Sep 10, 2014

Member

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

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