Martin Pilch
Martin Pilch

Reputation: 3295

Emgu CV - memory-leaks (memory consumption)

I am using EmguCV, the OpenCV wrapper for .NET. I am disposing all created objects but my app is still using more and more memory (in release configuration too). I have debugged my app using .NET Memory profiler and get this result:

http://img532.imageshack.us/img532/2503/screenqv.png

all objects instance count is oscilating but GChandle instance counr is increasing until my machine is unusable. Garbage collector does not release memory (i think).

I am using VS 2008 professional, Win7 prof 32-bit, both up to date, and last stable version of emguCV.

I can post some app code, if it will help.

Thanks and sorry for my English. Martin

Upvotes: 7

Views: 8430

Answers (2)

Andreas
Andreas

Reputation: 4013

public static class IImageExtensions
{
    // http://stackoverflow.com/questions/20825497/difference-between-using-and-dispose-call-in-c-sharp 
    public static void FreeMem(this IImage image)
    {
        using (image)
        {
            using (image.Bitmap)
            {

            }
        }
        //image.Bitmap.Dispose();
        //image.Dispose();
    }
}

Upvotes: 0

Shivam
Shivam

Reputation: 144

Have a look at the link below on how to do Automatic Garbage Collection.
http://www.emgu.com/wiki/index.php/Working_with_Images
I had a similar problem and I started to improve my code using the different guidelines on the link above.
Regards
Shivam

Upvotes: 1

Related Questions