Re: Memory allocation

I have one doubt. I want to know when we do a gtk_...._new(), to
create a new widget or window, whether memory is allocated or not? If

yes, structures are allocated for each class of object

memory is allocated at that time, when it will be deleted? I have a

either when you delete it (the elegant way) 
or when the application is closed, by the OS (the easiest way),

window with some widgets in it. I want to delete all the allocated
memory when the window is closed(suppose I am using a function called
"close_my_window" as the callback for close button widget in the
window). Can any body help me on this subject.

gtk_widget_destroy (window);

This function is supposed to free the window widget AND
all the gdk/gtk objects linked to window, at any nested level,
as buttons, etc.

gtk_main_quit ();

will free gd/gtk general resources, that
were not specifically required by the user,

How you handle exit operations depends of your 
own app, of course, but I think you should really try 
to free memory yourself, instead of waiting for the 
OS cleanup.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]