[Gc] doubts: gc, gc_cleanup classes

Renato Tegon Forti re.tf at terra.com.br
Mon Feb 11 05:31:50 PST 2008


Hi All,

 

I have one doubt, consider this class:

 

class Test : public gc 

{

public:

 

      Test ()

      {

            std::cout  << "Test Constructor." << std::endl;

      }

 

      ~ Test()

      {

            std::cout  << "Test Destructor." << std::endl;

      }     

};

 

int main(void)

{

      GC_INIT();

 

      for (size_t i = 0; i < 5; i++) new Test();

 

      return 0;

}

 

In this ample 'Test' is collectable, Ok?

 

When I run this sample my output is:

 

Test Constructor.

Test Constructor.

Test Constructor.

Test Constructor.

Test Constructor.

 

My destructor doesn't run.

 

My question is:

 

Only if my base class is: gc_cleanup the destructor will be called?

 

If my base class is: gc, what happen,  what will be freely?

 

About virtual destructor:  what happen?

 

Thanks.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20080211/77037d56/attachment.htm


More information about the Gc mailing list