[squeak-dev] Re: [FFI] ExternalStructure ownership (or not) of memory

Andreas Raab andreas.raab at gmx.de
Sat Apr 3 05:32:46 UTC 2010


On 4/2/2010 8:37 PM, Schwab,Wilhelm K wrote:
> Andreas,
>
> So ExternalStructure>>free is not invoked by default?  Sady to say, I never even considered that possibility.

It's not. Memory is cheap :-)

Cheers,
   - Andreas

> -----Original Message-----
> From: pharo-project-bounces-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org [mailto:pharo-project-bounces-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org] On Behalf Of Andreas Raab
> Sent: Friday, April 02, 2010 8:24 PM
> To: The general-purpose Squeak developers list
> Cc: Pharo-project-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org
> Subject: Re: [Pharo-project] [FFI] ExternalStructure ownership (or not) of memory
>
> I would suggest that you only register a finalizer for objects where you
> *do* have responsibility to reclaim them. There are no implicit finalizers registered for any subclasses of ExternalObject by default - the only thing that happens is that all handles are cleared when the image is restarted.
>
> Cheers,
>     - Andreas
>
> On 4/2/2010 5:17 PM, Schwab,Wilhelm K wrote:
>> Hello all,
>>
>> Suppose I have a pointer to a structure and I do or do not have the responsibility of reclaiming the memory when a corresponding ExternalStructure sub-instance is finalized.  How do I distinguish the two cases?  One idea I had is to explicitly set the handle to nil if I do not own the memory, but (please correct me if I'm wrong), I can't do that while I'm still using the instance because it will presumably use the handle in accessing the fields, right?
>>
>> Looking at implementors of #isExternalAddress, maybe the idea is to use a byte array to make a copy of memory and an address to refer to it.
>>
>> What should I be asking? :)
>>
>> Bill
>>
>>
>>
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project




More information about the Squeak-dev mailing list