[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: QMap bug ? (Re: kioslaves don't die?)
From: David Faure <faure () kde ! org>
Date: 1999-11-09 18:42:51
[Download RAW message or body]
> At Die, 09 Nov 1999 David Faure wrote:
> > > At Die, 09 Nov 1999 David Faure wrote:
> > > > > Boy. I need some coffee. What I meant to say here is that KIOJob re-uses the
> > > > > slaves for efficeincy and as such keeps io-slaves around using a least
> > > > > recently used LRU in memory cache. But AFAIK this is only in
> > > > > memory and nothing is supposed to be written out to file. Am I wrong
> > > > > here David ?
> > > > No this is right (we don't pollute /tmp anymore !),
> > > > but it doesn't explain the 100 kioslaves problem.
> > > >
> > >
> > > Hi
> > >
> > > probably I found to cause of the problem : QMap - which is used to store the
> > > running kioslaves - seems to hold one entry per key only. (protocol in that
> > > case) I added lots of debugging stuff in kio_job.cpp to find that out.
> > This
> > > really explains why processes get "forgotten". Anything we
> > > could do against it?
> >
> > Huh ??
> > A QMap can contain several entries per keys. I don't think that's the real
> > bug, otherwise a lot of stuff would be broken in KDE !!
> >
> > Well, perhaps you could check QMap's behaviour with a 4-lines test
> > program... Just to make sure :)
> >
> 4-line test? Hmm. I don't manage it that short. But - what is
> wrong with this 30-liner?
>
> ------------SNIP----------------
> #include <qmap.h>
> #include <stdlib.h>
> #include <stdio.h>
>
> int main (void)
> {
> char keyname[64];
> int i;
>
> QMap < QString, int > mymap;
> for (i=0;i<5;++i)
> {
> int r;
> r = rand ();
> #ifdef VARIABLE_KEY
> sprintf (keyname, "key%d", rand ());
> #else
> strcpy (keyname, "key");
> #endif
> mymap.insert (keyname, r);
> printf ("New member: key %s , random %d\n", keyname, r);
> QMap < QString, int >::Iterator it = mymap.begin ();
> while (it != mymap.end ())
> {
> printf ("Key: %s Content : %d\n", it.key ().data (), (*it));
> ++it;
> }
> }
> }
> ---------------SNIP----------------------
>
>
> With VARIABLE_KEYS undefined I get :
>
> New member: key key , random 1804289383
> Key: key Content : 1804289383
> New member: key key , random 846930886
> Key: key Content : 846930886
> New member: key key , random 1681692777
> Key: key Content : 1681692777
> New member: key key , random 1714636915
> Key: key Content : 1714636915
> New member: key key , random 1957747793
> Key: key Content : 1957747793
>
> With VARIABLE_KEYS defined I get :
>
> New member: key key846930886 , random 1804289383
> Key: key846930886 Content : 1804289383
> New member: key key1714636915 , random 1681692777
> Key: key1714636915 Content : 1681692777
> Key: key846930886 Content : 1804289383
> New member: key key424238335 , random 1957747793
> Key: key1714636915 Content : 1681692777
> Key: key424238335 Content : 1957747793
> Key: key846930886 Content : 1804289383
> New member: key key1649760492 , random 719885386
> Key: key1649760492 Content : 719885386
> Key: key1714636915 Content : 1681692777
> Key: key424238335 Content : 1957747793
> Key: key846930886 Content : 1804289383
> New member: key key1189641421 , random 596516649
> Key: key1189641421 Content : 596516649
> Key: key1649760492 Content : 719885386
> Key: key1714636915 Content : 1681692777
> Key: key424238335 Content : 1957747793
> Key: key846930886 Content : 1804289383
>
>
>
> Can you test it on your machine too?
Just did. Same behaviour here !
(Using Qt CVS from 30-Oct-1999)
But .. reading qmap.h ... insert() calls insertSingle() so this
would be expected.
insertMulti() exists but only in QMapPrivate ??!??
Torben ?
--
David FAURE
david@mandrakesoft.com, faure@kde.org
http://home.clara.net/faure/
KDE, Making The Future of Computing Available Today
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic