[fpc-devel] Suggestion: reference counted objects

Chriss Kalogeropoulos iz.iznogood at gmail.com
Thu Sep 25 17:23:37 CEST 2014

Hi Sven,

Can you comment on how are you going to handle the case of
TInterfacedObject and descendants? Are you going to use the same Addref &
Release method ? How can you guarantee that the same counter will be
updated in case of IUnknown implementations that introduce their own
refcount variable (possibly with different name)?

Are you going to check that the class is already destroyed (because the arc
has killed the instance) on IInterface.Release so that we should not get
access violations on scenarios that mix ref counted classes and interfaces ?

Thanks for your time and efforts,
Στις 25 Σεπ 2014 4:14 μ.μ., ο χρήστης "Sven Barth" <
pascaldragon at googlemail.com> έγραψε:

> Am 25.09.2014 11:59 schrieb "Michael Schnell" <mschnell at lumino.de>:
> >
> > On 09/22/2014 08:37 PM, Boian Mitov wrote:
> >>
> >> Honestly if you don’t know what you are doing when using ARC, I doubt a
> bit, you really know what you are doing otherwise either ;-) .
> >
> > Ref counted strings are no problem with any (normal) use of same.
> >
> > In this thread you find an example describing how ARC Objects easily can
> impose memory leaks.
> Not really. The object instances themselves won't create memory leaks,
> because with strings you don't get them either. The only problems are
> typical "not threadsafe" problems of the classes themselves and there ARC
> won't help you anyway as this is the programmer's job to ensure.
> ARC objects will only be destroyed when the last reference to them has
> gone out of scope. If there is still a reference, then there's still the
> object.
> Regards,
> Sven
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140925/a06d0554/attachment.html>

More information about the fpc-devel mailing list