Andre Poenitz wrote:
On Fri, Feb 22, 2008 at 04:46:44PM -0500, rgheck wrote:
Andre Poenitz wrote:
Does anybody remember why we use a shared pointer and not an index into
the global list of textclasses?
Yes, that was my doing.

So this is a recent change?

A few months back.
You don't have to keep the textclasses around forever; only so long as
something's using them. So if you had the global list and opened a
document, and then loaded a module, you'd have two entries in the
global list, since you can't tell (or, at least, it's very hard to
tell) whether some bit of cut text has a reference to the old one. And
if you do this a few times, you can end up with several of these lying
around.

So basically we use the shared pointer to potentially save a few kBytes for users opening/closing lots of different documents in a single session?

Yes, fair enough.
Now they're probably not all that huge, so maybe that doesn't matter
so much. But that was my thinking at the time.

Hm, ok... I see your point, but I think I consider the 'worst case
scenario' described a really rare case and rather have the index based solution. [Apart from that, if need arises there could be some 'garbage
collection' of unused classes without much effort...]

Right. At least I did encapsulate all of that in TextClassPtr, which is just a typedef, so it wouldn't be that hard to change.

rh

Reply via email to