bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HV and SV problem


From: Gavin Smith
Subject: Re: HV and SV problem
Date: Sat, 7 Jun 2025 09:42:10 +0100

On Sat, Jun 07, 2025 at 09:51:50AM +0200, Patrice Dumas wrote:
> On Fri, Jun 06, 2025 at 07:27:55PM +0100, Gavin Smith wrote:
> Indeed, that's the issue, thanks for the analysis.  What confused me is
> that in Perl code, it does not happens that way, but I think that it is
> because the Perl scalars are not the same as a SV in XS, the SV can be
> shared in XS and keeps being shared when Perl code is applied, in Perl
> it is not possible, the references are copied instead of being shared,
> if I may say.  Using newRV_*inc creates a new SV each time, making the
> previous code more similar to what happens in Perl code.
> 
> I found newSVsv, which seems to copy the SV, including the blessing and
> the 'reference' to the HV, this could be an alternative to keeping the
> HV in C and calling newRV and blessing each time a reference is needed.
> I still need to check if there needs to be an adjustment of reference
> counting.  Note that I switched to keeping the SV to avoid needing to
> bless each SV created by newRV_*inc.

I see, I hadn't understood the purpose of the change.  At least one
of these options should work for fixing the problem.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]