[Kst] [Bug 115670] Some datasources call constructors/destructors [nb_vectors] times upon reload

George Staikos staikos at kde.org
Wed Nov 9 05:57:38 CET 2005

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

------- Additional Comments From staikos kde org  2005-11-09 05:57 -------
On Tuesday 08 November 2005 05:09, Nicolas Brisset wrote:
> >   It's mostly because the datasources expected this, and well, how do you
> > "reset" a datasource?  If it has no reset() function, then the only
> > choice is to destroy it and create a new one.
> Sure, when reset is not implemented you can only destroy it and create a
> new one. This is *not* what I was wondering about...
> The thing that surprised me was that you'd need to destroy it and create a
> new ones 10 times if you are using 10 vectors from that datasource, 15
> times if you are using 15, etc. To me, it sounded like destroying the
> datasource instance and recreating one should be enough to allow access to
> all its vectors.
> As a matter of fact, trying to evidence my point, I noticed that
> - with cdf (which implements reset, please ignore my wrong comment above!),
> the reset() method gets called as many times as there are vectors - with
> another datasource not implementing reset(), the constructor gets called as
> many times as there are vectors, after which the initial datasource
> instance is destroyed. If you reload more than once, only the first
> instance created in the previous loading gets killed, which looks to me
> like a potential memleak...

  I don't think a leak is possible.

> Once again, I understand the need for a reset() method or destroying and
> creating a new datasource as fallback, but I still wonder why it depends on
> the number of vectors provided by that source. Pardon me for insisting on
> this, but I definitely feel there is something strange there. Why should we
> call reset() more than once, when it actually resets the whole datasource
> instance so that one call would be enough, and why would we need x
> instances of a given datasource if it provides x vectors (especially when
> they are not destroyed later) ?

  OK calling reset that many times is clearly also slow.  I need to come up 
with a solution for how to fix this though.  It will take some time and may 
wait until 1.3.

More information about the Kst mailing list