[webkit-dev] Question about javascriptcore garbage collection

Darin Adler darin at apple.com
Sat Sep 3 23:56:37 PDT 2005


On Sep 3, 2005, at 3:12 PM, Kurt Kohler wrote:

> Shouldn't the destructor in ValueImp be virtual? I'm not totally  
> clear on this but I understand there can be problems if destructors  
> aren't declared virtual in virtual base classes. ValueImp isn't  
> actually virtual, but the derived classes are. Maybe that's how  
> platform
> dependencies are arising.

Well, there are never any instances of ValueImp created, because  
ValueImp is only a class that means "special pointer values or  
AllocatedValueImp".

In any case, the issue here is a difference in how virtual tables are  
handled between Windows Visual C++ and GCC on Unix/Mac OS X. And the  
fix is indeed to mark the ValueImp destructor virtual. I've done that.

The reason the AllocatedValueImp class exists at all is that if you  
have an AllocatedValueImp * then you know it's not a special pointer  
value and can dereference it without checking first.

And as mentioned in the blog, the names of these classes (ValueImp  
and AllocatedValueImp) are soon going to change to JSValue and JSCell.

     -- Darin




More information about the webkit-dev mailing list