Re: (Easy?) Newbie enquiry re: pointers
- From: "Tomasz Jankowski" <tomcioj gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: (Easy?) Newbie enquiry re: pointers
- Date: Tue, 10 Oct 2006 22:09:49 +0200
06-10-10, Samuel Cormier-Iijima <sciyoshi gmail com> napisaÅ(a):
Yea, I wasn't sure whether to put a :-( or a :-) ( :-) ). The thing
is, strings getting copied around so often seems like memory waste to
me... when it passes the text to Pango, does that keep a pointer
itself? freetype? how many times is the same text kept multiple times
in memory? i guess for strings it doesnt really matter because it's
not that much memory wasted. Still, gnome/gtk's memory usage seems
pretty high (see ReducingMemoryUsage on the wiki)
GTK+ is basen on GObject, which stores most of parameters with GValue. If
you will look how GObject's objects works, you will see, that if they are
well implemented, they will release used memory every time, when we will try
change value of some parameter, which is allocating memory (like strings in
GtkLabel).
Moreover I must say, that you aren't completely right saying, that GTK+
based programs leaks memory, or that their memory usage is high. If you are
working with some GTK+ application, you can see, that whole program
allocates pretty much memory, that is right. However it doesn't mean, that
this program uses whole allocated memory whole the time, because it doesn't,
it use only some part of it and rest is treated as buffer for future memory
usage. Such behave makes GLib based programs (GTK+ is based on GLib, but
GLib provides memory management subsystem, so GLib is responsible for
memory usage) faster, because they doesn't need time for physical allocating
and releasing memory. Programs are faster (at least theoretically), but they
allocate more memory then non GLib programs, so for some of us it will be
waste of memory and for rest not.
Note, that Pango uses GLib too.
--
Pozdrawiam!
Tom
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]