[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: user data not allocated by lua
- From: Nicolas CARRIER <carrier.nicolas0@...>
- Date: Tue, 22 Jul 2014 07:33:04 +0200
Ok, your solution is interesting, but my issue doesn't correspond well.
The problem is, because of how the API is written, the whole array
address array must be freed at once, so I can't store only an address in
the tiny user data, but also a pointer, or something to retrieve the
address of the original array. What's more, I can't free the array when
the garbage collector decides to free one address, because the others
could be still in use, so I have to implement a mechanism for freeing it
at the right time (e.g. reference counting).
So I think I'll make a copy of each address in a lua allocated user data
and let lua take care of all.
For information, the address structure is basically a union of the
standard address types: socaddr_in, _in6 and _un, so an address is
approximately a hundred of bytes.
Thank you for the ideas and all the useful information.
Le lundi 21 juillet 2014 à 12:33 -0700, firstname.lastname@example.org a
> Re: user data not allocated by lua