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

Schwab,Wilhelm K bschwab at anest.ufl.edu
Sat Apr 3 00:17:53 UTC 2010


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




More information about the Squeak-dev mailing list