[Mono-list] Ok this is probably an odd question and very general

Chris Howie cdhowie at gmail.com
Fri Jun 20 17:23:11 EDT 2008

On Fri, Jun 20, 2008 at 4:55 PM, Jerry Houston <jerry at effjayare.net> wrote:
> Interesting!  I don't know a lot about mono, but I've been a professional
> .NET developer since v1.0 beta.  I would have expected GC to take care of
> img without calling Dispose() explicitly.  We would normally consider that
> something to be avoided.  Setting img to null (or simply assigning a new
> value) should hasten garbage collection, and quickly release any underlying
> system resources.
> Are things really that different with mono?  One of these days, I'll have
> time to work with it more, I swear!

Not different from .NET at all.  If you use a FileStream, you dispose
it when you are done.  Or you wrap it with using() {}.  A Gdk.Pixbuf
corresponds to a bitmap held in X server memory, so it is as much a
native resource as a FileStream.

Not disposing your FileStreams is bad practice.  Same with not
disposing a Pixbuf.

Chris Howie

More information about the Mono-list mailing list