Subj : Re: finilize & construct: call disbalance To : anton muhin From : Brendan Eich Date : Thu Jul 08 2004 03:29 pm anton muhin wrote: > With the session my constructor (in C) is called once. However, the > finilizer (in C also) is called three times and it's only the last time > when it gets called with the object created in the constructor. Is it > normal or I do something stupid? When you call JS_InitClass, it creates a prototype object of your class, so that object will be finalized too. It won't be constructed, though -- you have to call the constructor yourself, if you need to. Most class prototypes don't need to be constructed, but that means if JSCLASS_HAS_PRIVATE, JS_GetPrivate will return null for such objects, so your finalize implementation has to null-check. You'll have to debug a bit more to say why you see two finalizes other than the one for the instance you create explicitly in JS, via new. Perhaps you JS_InitClass in two different global objects? /be .