Face Basic WPF Memory Leak RRS feed

  • Question

  • I've got a long running app that tracks faces and bodies.  I used the example app from the SDK "FaceBasics-WPF".

    The problem I am consistently getting is that my memory will crash every few hours with an out of memory exception.

    I was able to duplicate this in the example app "FaceBasics-WPF".  Each time a face/body comes into view of the kinect it allocates some memory for them but it is never released.  

    I ran a memory profile in release mode of the sample app and it would allocate about 4 mb for every time a new face entered the screen.

    Any advice how to proceed?  I am fairly sure this is an issue with either the example or the framework itself.  I am able to do it consistently in the sample app.  I am looking for any suggestions on how to avoid this memory leak.  

    • Edited by Backhander451 Thursday, December 29, 2016 9:53 PM Font size
    Thursday, December 29, 2016 9:50 PM

All replies

  • I checked both C++ FaceBasics-D2D and C# FaceBasics-WPF samples to see differences in API usage and in API exposed for .NET and win32.
    My suspicion is: FaceFrameResult is not being disposed - In C++ sample IFaceFrameResult is a COM object (as all COMs it is derived from IUnknown > it has a Release() method used with all readers / sources / frames in Kinect API)

    In .NET version of API alternative to "Release()" method is being exposed through IDisposable interface.
    If you check the FaceFrameResult in .NET version you might notice that it has protected Dispose(bool) method (as a part of "proper" dispose pattern) but does not implement IDisposable interface and is missing public Dispose() method, although it has a destructor defined (still, smells very fishy).   

    Could you do a bit of investigation if the same behavior can be reproduced using D2D sample? 
    Which version of OS, .NET runtime & Visual Studio you are running?

    Monday, January 2, 2017 10:53 PM
  • I have tried several times and have not gotten the D2D sample to reproduce you.  

    This is on Windows 10, .NET 4.5.2 using Visual Studio 2015.  

    Sunday, January 8, 2017 8:23 PM