|
window内单一按键,按键callback函数在控制台打印“hello world”。不停点击按键,在任务管理器中监视,会不停产生内存增量。求大神解释~
window产生就会使用10M+的内存。。。。。求大神解释。。。。
#include <gtk/gtk.h>
static void hello( GtkWidget *widget,
gpointer data )
{
g_print ("Hello World\n");
}
int main( int argc,
char *argv[] )
{
GtkWidget *window;
GtkWidget *button;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
button = gtk_button_new_with_label ("Hello World");
g_signal_connect (button, "clicked",
G_CALLBACK (hello), NULL);
gtk_container_add (GTK_CONTAINER (window), button);
gtk_widget_show (button);
gtk_widget_show (window);
gtk_main ();
return 0;
} |
|