Skip to content

Commit

Permalink
DOC: Note that object returned by CreateInstance has reference count 2
Browse files Browse the repository at this point in the history
Follow-up to commit 8e3c544 "BUG: The ability
to override classes with factories was not working", Bill Lorensen, Nov 8, 2007.
  • Loading branch information
N-Dekker committed Jul 17, 2023
1 parent cdbbdf9 commit f981aae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Modules/Core/Common/include/itkObjectFactoryBase.h
Expand Up @@ -73,7 +73,11 @@ class ITKCommon_EXPORT ObjectFactoryBase : public Object
/** Create and return an instance of the named itk object.
* Each loaded ObjectFactoryBase will be asked in the order
* the factory was in the ITK_AUTOLOAD_PATH. After the
* first factory returns the object no other factories are asked. */
* first factory returns the object no other factories are asked.
*
* \note The object returned by `CreateInstance` will have a reference count of 2, instead of 1. So in order to avoid
* memory leaks, one may need to call `object->UnRegister()`.
*/
static LightObject::Pointer
CreateInstance(const char * itkclassname);

Expand Down

0 comments on commit f981aae

Please sign in to comment.