Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2000:
[Freeciv-Dev] Re: out of disk space? (PR#615)
Home

[Freeciv-Dev] Re: out of disk space? (PR#615)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Thue <thue@xxxxxxx>
Cc: Paul Dean <Paul@xxxxxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: out of disk space? (PR#615)
From: Andreas Kemnade <akemnade@xxxxxxxxxxx>
Date: Mon, 4 Dec 2000 21:43:59 +0100 (CET)

Thue writes:
 > On Mon, 04 Dec 2000 13:41:19 Paul Dean wrote:
 > > Thue <thue@xxxxxxx> writes:
 > > 
 > > > It is known there is a memory leak in the windows client. It is
 > > > probably in windows gdk. Someone go fix. :)
 > > 
 > > Also in the gtk client.  I have 250MB of swap space and it gradually
 > > gets used up while playing.  I quite the client, restart and it's back
 > > to normal.
 > > 
 > > How do I go about tracking a memory leak?
 > 
 > Umm, the gtk client uses gdk, so we are talking about the same thing.
 > We know from earlier that the leak occurs when a unit blinks. By tracing
 > the calls that function makes it seems likely to happen somewhere in
 > client/gui-gtk/mapview.c:update_map_canvas() . And from there it seems
 > likely to happen in gdk_draw_pixmap(). So start by checking if that is
 > correct by modyfying the code there to call that function 10000 times in a
 > row. If the leak is there you will then know :)
 > Assuming that really is the problem, get the gdk source code for windows
 > and start looking at it :).
 > 
Ups, I have not click on "reply to all". Sorry.
Here a short test programm I used to test if there is a memory leak in
gdk_draw_pixmap

This program has no memory leak (at least on win95). Does it mean that
gdk_draw_pixmap is correct? Perhaps the memory leak is in
gdk_gc_set_clip_mask?

#include <gtk/gtk.h>
int main(int argc, char *argv[])
{
  int i;
  GdkGC *mygc;
  GtkWidget *window;
  GtkWidget *drawing_area;
  GdkPixmap *pixmap;
  gtk_init(&argc,&argv);
  window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
  drawing_area=gtk_drawing_area_new();
  gtk_widget_set_usize(drawing_area,300,300);
  gtk_container_add(GTK_CONTAINER(window),drawing_area);
  gtk_widget_show(drawing_area);
  gtk_widget_show(window);
  pixmap=gdk_pixmap_new(drawing_area->window,100,100,-1);
  mygc=gdk_gc_new(drawing_area->window);
  while (1)
    {
      for (i=0;i<2000;i++)
        {
          gdk_draw_pixmap(drawing_area->window,mygc,pixmap,
                          0,0,0,0,100,100);
        }
      sleep(2000); /* Windows uses msecs */
 
    }
}         

Greetings
Andreas Kemnade



[Prev in Thread] Current Thread [Next in Thread]