Hi,

Well, putting the inner objects on the stack may require a large stack (we
are assuming arbitrarily complex and deeply nested data structure).  If we
do the double initialization approach, we first initialize the struct
itself (mostly to zero), and then assign the inner objects directly to the
struct data.

Is this simply a classic time-space trade-off?  Maybe not, because we have
to eventually reassign the references from the stack to the struct
data.  So, is the double initialization approach actually better?

Regards,

Bill
============================================================================
Paul Brannan <pbrannan / atdesk.com> wrote:
> Put a reference to the inner object on the stack immediately after
> calling Data_Wrap_Struct, and the object won't get collected until the
> some time after the stack is unwound.

> Paul