[fdo-users] Memory management and FdoPtr

Snehal Joshi snehal.joshi at gmail.com
Sat May 12 12:01:58 EDT 2012


Thanks Gavin. I'm assuming that the caller of this method could then just
use FdoPtr while getting the return value, or call FDO_SAFE_RELEASE to take
care of releasing its share of object ownership. Is that correct?

Many thanks,
Snehal

On Fri, May 11, 2012 at 11:11 AM, Gavin Cramer <gavin.cramer at autodesk.com>wrote:

>  Hi, Snehal.  In your use case is probably the most common for
> intermediate code that retrieves and also returns ref-counted FDO types.
> The only special action to take is in the return statement, when it is
> necessary to increase the ref-count to preserve your method’s “share” of
> object ownership on behalf of its caller.****
>
> ** **
>
> FdoPtr<SomeFdoType> ret;****
>
> ret = CallSomeMethod();****
>
> return FDO_SAFE_ADDREF(ret.p);****
>
> ** **
>
> Best wishes,****
>
> Gavin****
>
> ** **
>
> ** **
>
> *From:* fdo-users-bounces at lists.osgeo.org [mailto:
> fdo-users-bounces at lists.osgeo.org] *On Behalf Of *Snehal Joshi
> *Sent:* Friday, May 11, 2012 12:03 PM
> *To:* FDO Users Mail List
> *Subject:* [fdo-users] Memory management and FdoPtr****
>
> ** **
>
> Hi All,****
>
>  ****
>
> I just started using FDO libraries, and have a question regarding memory
> management in FDO. I am confused about when to use FdoPtr and
> FDO_SAFE_ADDREF/FDO_SAFE_RELEASE. ****
>
>  ****
>
> Based on the information in the Developer's Guide, my understanding is
> that FdoPtr will take care of incrementing the reference count/release the
> object (provided the class implementes FdoIDisposable) - however, it'll
> call Release() as soon as the FdoPtr goes out of scope. So, within a
> function I write, if I wrap the return values of one of the FDO create/get
> methods in an FdoPtr, and return that FdoPtr as a function return value,
> it's a bad idea. Is that a valid assumption?****
>
>  ****
>
> Thanks,****
>
> Snehal****
>
>  ****
>
>  ****
>
> _______________________________________________
> fdo-users mailing list
> fdo-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fdo-users/attachments/20120512/61906d1e/attachment.html


More information about the fdo-users mailing list