At 08:11 PM 3/7/2001 -0500, 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?
You need to get the refcounts correct for the elements of the array. It
looks like the else section of the end if statement fetches things out of
an array and sticks them in this one without incrementing their refcounts.
That might be your problem.
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk