[Gtk-sharp-list] Memory usage

Alexandros Frantzis alfius at freemail.gr
Wed Jul 20 02:16:39 EDT 2005


On Tue, 2005-07-19 at 12:52 -0400, Nebojsa Djogo wrote:
> The only issue I have is the memory usage. The game is constantly
> drawing on the .Drawable surfaces - many times per second as there are
> simply sprites moving around.
> I deliberately wanted to copy and draw larger portions of the window
> at times with transparency to test the performance as this was my
> first Gtk# project.
> I even put in a call to GC.Collect() at certain intervals to make sure
> it's not the issue with GC.
> 
> After a while the memory usage goes up to several hundreds of Mb. I
> tried tracking down the leak and I always end up in Gtk libraries.

The Drawable class implements the IDisposable interface because its
unmanaged resources can't be safely collected by the GC. You should
explicitly free any drawables you don't need by using the Dispose()
method (eg myDrawable.Dispose() ).

HTH
Alexandros



More information about the Gtk-sharp-list mailing list