Hi,

I am creating an object of AxShockwaveFlash

private AxShockwaveFlash flash;
void init()
{
  this.flash= new AxShockwaveFlashObjects.AxShockwaveFlash();
}

and releasing it in

protected override void Dispose(bool disposing)
        {
            if (_flash!= null)
                _flash.Dispose();
}

but when i am using .Net Memory Profiler i am getting following message

"The instance has been disposed but still has not been GCed."

I am not able to get any solution for this .Why it is not GCed and why it is giving me a memory leak? while i am using Dispose().

Regards

ShaBeg

Check out this great article: http://ondotnet.com/pub/a/dotnet/2002/02/11/csharp_traps.html

in the article: "...because finalization is nondeterministic (meaning you can’t control when the garbage collector will run)..."

Dispose() can be used for any and all cleanup required but the garbage collector will gather the object and call it's destructor (thus finalizing the job).

I would say unless you are noticing via a profiler that the memory is not reclaimed it's probably getting GC'd later.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.