Re: instance-private-data issue



Hi,

Le dim 03/08/2003 à 02:08, Owen Taylor a écrit :
> So, say you have classes MyA, MyB, MyB deriving from MyA. And
> you have an instance init function for My:

I guess you mean MyA above.

[snip]

> So, how do we fix the problem? Two ideas I can come up with:
> 
>  - increase GTypeInstance from 4 bytes to 8 bytes (on
>    32 bits), caching the real type *before* the public g_class field.
> 
>  - Use thread-private data to keep track of a stack of
>    currently-being-initialized objects with their real types, and 
>    have g_type_instance_get_private() check that.
> 

I'd go for the thread-private stack: increasing the GTypeInstance size
feels like unneeded overhead at all times when there is need only for
specific overhead at one point in time (ie: initialization).

However, the cost in terms of additional implementation complexity might
not be worth it (given the beauty of the current codebase, it might be
worth not trying to make it any more beautiful :). Are there really
people around who rely on being able to create thousands of small GTypes
?

my 2 cents,
Mathieu
--
Mathieu Lacage <mathieu gnu org>





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