Re: some thoughts..



Andreas Kostyrka <andreas@rainbow.studorg.tuwien.ac.at> writes:

> On Wed, 6 May 1998, Timo Sirainen wrote:
> 
> > > > These extensions probably use a lot of memory to do things which usually
> > > > aren't done all the time, so it just uses megs of totally useless memory
> > > > most of the time. This seems to be the problem with whole KDE, it takes
> > > > over 11 megs of memory (+shared 2-5MB?) to do things I mostly don't need.
> > > > Solutions? I can think of some:
> > > As long as the code isn't used, all you loose is the memory allocated to
> > > the page tables. (Linux does on demand paging of executables.)
> > 
> > I can't really believe this works well. Well, maybe if the application is
> > build so that Linux knows right what code is used, but for example
> > netscape and kde, why do they take so much memory and don't work well
> > with computers with low memory? They use all their code and do "if
> > (!do_i_need_to_do_something()) return" type things everywhere? I don't
> > know, but I'm sure I haven't used any sounds and still KDE's sound servers
> > eat megs of memory.
> 1.) The soundserver is still started.
> 2.) The soundserver still waits for requests.
> 3.) The soundserver still tries to process requests.
> So the soundserver is practically used as a whole.
> 
> One additional thing is, that KDE is 99% C++, and C++ has a tendency to be
> a memory hog. (tempates need memory during compilation, AND during
> runtime, as array<char *> and array<void *> do have usually two different
> function sets generated. GList's one the other hand have their code once
> in the system.)

This is not correct. If you use partial specialization [a newer C++ feature]
it'll generate one implementation. The SGI STL uses that to lower memory
usage. I don't know if mico's ministl uses that too, if not it might explain
some of the bloat. 

It basically works like this:

template <class T> 
list<T *> ....

Then the compiler will use this version for all pointer types. 

-Andi 



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