On Wed, 7 Mar 2001, Kort, Eric wrote:
>>-----Original Message-----
>>From: Morten Bøgeskov
>>
>>On Wed, 7 Mar 2001, Kort, Eric wrote:
>>><snip>
>>> return newRV_inc((SV*)avMask);
>>
>>
>>As I see it.. I mighe be off here, but you create an array (avMask),
>>with
>>a refcount of 1 and increases the refcount when returning the ref.
>>There if only one reference to it in ``perl space'', but count of 2.
>>maby newRV_noinc((SV*)avMask); would do it..
>
>What you say is in line with perlguts. However, when I tried newRV_noinc in
>the code snippet in question, I got screen fulls of "attempting to free
>unreferenced scalar" errors, suggesting that the reference count of the AV*
>was going prematurely to 0. Perhaps it is because in this case there is no
>pre-existing SV* (I am creating one by casting the AV* to SV*), so it NEEDS
>to have its reference count incremented?
>
>I don't really know...newRV_noinc has worked for me in the past, but not
>here. Any other ideas, anyone?
>
try dumping the refcount (man:perlapi.3)
SvREFCNT
Returns the value of the object's reference count.
U32 SvREFCNT(SV* sv)
And let us see how it is counted. It just might give us some hints.
Yours
--
Morten Bøgeskov (email: [EMAIL PROTECTED])
I drink: milk, rum, and sugar. Milk for vitality, sugar for pep,and the
rum to let you know what to do with all that pep and vitality...