Just the last details.  I want to use

    ptr = ALLOC(struct_C);

because the data is really a pure C data (no Ruby object involved).  Using
Data_Make_Struct to do the allocation would be overkill, don't you think?

I guess my original post was so long that some details were really lost,
but really I have tried to explain that this problem is only an issue
when the struct is one or more levels deeper inside the wrapping object.

Yes, the discussion became difused somewhat because really the current
difference between ALLOC() and alloc() involves two aspects: the memory
problem when ALLOC() is not used properly and the execution performance
difference between the two.  I myself sometimes confused as I am learning
to program in this Ruby/C world.

Thread.current.kill(-9) ?   :)

Regards,

Bill
============================================================================
Mauricio Fern?ndez <batsman.geo / yahoo.com> wrote:
> It get it now. I just couldn't see why you'd like to do
> 	ptr = ALLOC(struct_C);
> instead of using Data_Make_Struct(). But well, I guess it's for
> performance; since you're already making res, yet another VALUE if
> pointless.

> BTW, I do believe this thread wouldn't have been so loong if you had
> explained before that the top level object manages (marks) things inside
> struct_C instead of letting it do this itself. It turns out Guy's
> last post reflects that he (amongst several others) thought there were
> only two layers involved. As for me, I couldn't see why you were so
> pressed to use ALLOC(struct_C) instead of Data_Make_Struct and letting it
> manage its fields.
> In fact, I now remember that's how this discussion started (performance when
> wrapping C structs), but it was so long ago I think we all forgot it :-)

> I consider we finally did Thread.current.kill ;->