[Mono-devel-list] GC with Pixbufs

Chris Seaton chris at chrisseaton.com
Mon Mar 15 15:55:46 EST 2004


>>I have a program that generates thumbnails of images for web pages. 
>>Creating a thumbnail simply involves reading the file into a Pixbuf 
>>image, scaling it into a new Pixbuf and saving it.
>>
>>Mono doesn't seem to ever GC these Pixbufs. They are only referenced 
>>from local variables in functions when the thumbnail is being created so 
>>I'm sure they're elligible for deallocation.

> You should use the explicit Dispose method of Pixbuf in these cases
> (since you are using an unmanaged resource that the managed world has no
> idea what it is).
> 
> Miguel

I'm calling Dispose for both bitmaps, but mono continues to leak memory 
when creating these thumbnails. I've attatched the modified source file. 
I am using Dispose correctly, aren't I?

Chris
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Thumbnail.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040315/b6ba5a56/attachment.pl 


More information about the Mono-devel-list mailing list