[fpc-pascal] Memory leak or object destruction?

Andrew Hall andrew.hall at shaw.ca
Thu Feb 3 06:09:42 CET 2011


Interfaces support reference counting.

ISomeObject = interface

TSomeObject = class(TinterfacedObject, ISomeObject)

var
 MyObj: ISomeObject;

Regards,

On 02 Feb 11, at 15:22 , Bo Berglund wrote:

> Will this create a memory leak or will FPC fnd by reference counting
> that nothing references the object memory and dispose of it?

> What happens here where the local variable MyObj gets out of scope,
> again with the reference to object memory disappearing?
> Memory leak or object destruction?




More information about the fpc-pascal mailing list