Re: [Vala] Question about Gtk.Builder



Why do you bother about closing mainwindow ? In 99% of cases, your
application will end when you close (really, not miniminzing) your
mainwindow. And here that is the case.
Then, OS will reclaim resources ending the application ; so, Why bother ?
Destroying mainwindow is a very special case.

Not bothering about the cleanup when closing application is a very,
very bad idea. The system will reclaim all resources, but if you want
to ever use valgrind or maybe in the future there comes up the idea of
some reusing actual code or extending the application with some new
features, you get total mess. Not to mention that there ARE systems
where the kernel will not reclaim memory and you have a leak (but ATM
we don't have glib port to BREW, do we?)


well, i must say i don't know exact specifics. but as i get it vala should
free memory by it self. as soon as your ref count per any object falls to
zero memory manager vala should dispose it. and that should happen at the
end of code block. in my eyes following the previously suggested of not
taking care should work as it should.

but if you want to be sure, doing something like
myobject.weak_ref ((o) => { stdout.printf ("my object disposed"); });
should answer this better if you test it for your self. if you connect
this signal you will see if finalizing was executed or not when program
exits.

method simply calls
http://www.gtk.org/api/2.6/gobject/gobject-The-Base-Object-Type.html#g-object-weak-ref
which is called upon finalizing without deadlocking that object.

As for the OP's question, I must say that I don't know, but the
question looks perfectly reasonable to me.


yes, it is... for c and likes, but in language where memory is garbage
collected like in vala, question should be completely unreasonable
***unless your code manually allocates memory***. if there is a memory
leak, it has to be fixed in memory manager.

with regards
matjaz


best regards,


As far as I've seen for now ; someone correct me if I'm wrong.

2010/10/8 Tomasz Jankowski <tomcioj gmail com>

Hello!

I found at Vala's home page sample code showing how to use Gtk.Builder
(
http://live.gnome.org/Vala/GTKSample#Loading_User_Interface_from_XML_File).
According to GTK+ API reference for C, programmer is responsible for
destroying toplevel window. Sample's author forgot about cleaning up
or omitted it deliberately because Vala will destroy free all resources
for
me?

_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




--
Dupuy Mathieu
Epitech 2011.


--
Mój klucz publiczny o identyfikatorze 1024D/E12C5A4C znajduje siê na
serwerze hkp://keys.gnupg.net

My public key with signature 1024D/E12C5A4C is on the server
hkp://keys.gnupg.net
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list






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