[Insight-developers] itkCellInterface

Miller, James V (Research) millerjv at crd.ge.com
Mon Jun 20 14:33:50 EDT 2005


One thing that the code is doing is skipping the object factory. But it also has
a difference from the NewMacro() wrt the reference count.  Objects created with 
the NewMacro start with a reference count of 1 on construction.  The count
rises to 2 when the pointer is assigned to the smartpointer to be returned.
Then it is decreased down to 1 before it leaves the macro.

Can you run a quick test?  Create an instance and assign it to a SmartPointer.
Then print out the reference count on the object.  I suspect that the reference
count will be 2. Which is one too high.

Jim

-----Original Message-----
From: insight-developers-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-developers-bounces+millerjv=crd.ge.com at itk.org]On Behalf
Of Leila baghdadi
Sent: Monday, June 20, 2005 1:59 PM
To: insight-developers at public.kitware.com
Subject: [Insight-developers] itkCellInterface


Hi everyone,

I am just wondering why the following line on itkCellInterface.h (line
182)is replaced, it makes me a bit unclear about garbage collection and
hence leaks

 //itkNewMacro(Self);
 static  Pointer New(void) { return new Self; }



Thanks


Leila

_______________________________________________
Insight-developers mailing list
Insight-developers at itk.org
http://www.itk.org/mailman/listinfo/insight-developers


More information about the Insight-developers mailing list