Freeing memory allocated at C function

Pedro Lacerda kanvuanza at gmail.com
Fri Mar 23 17:44:19 PDT 2012


On Fri, Mar 23, 2012 at 3:43 AM, Ali Çehreli <acehreli at yahoo.com> wrote:

> You can register on GC if you wrap the resources in a class. Then the
> class object's destructor would call the clean up code. The problem is, it
> is undeterministic when the destructor will be called, or will it be called
> at all!
>
> Or you can wrap in a struct which has deterministic destruction like in
> C++, when leaving scopes.
>


The object is long lived, so the class wrapper is the way to go.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20120323/47794be9/attachment-0001.html>


More information about the Digitalmars-d-learn mailing list