After a week of debugging I could trace a bug, that eventually
corrupts the memory, down to double typed SV's. I tried to use an
SV as a blessed reference and as an integer value, using the
following code:
rv=sv_2mortal(newSViv((IV)obj));
SvRV(rv)=hv;
SvROK_on(rv);
sv_bless(rv,stash);
(void)SvIOK_on(rv);
To make debugging almost impossible, hv in the above example is a
reference to a hash tied to another blessed sv (using magic). I also
used OVERLOAD on the resulting object (rv in the above code). For a
while everything worked just fine, but with growing testcode I run
into serious problems with corrupted memory. Debugging was a
nightmare, since with every change in code the problem would appear
at another place or not at all. Removing the double typing finally
seems to have taken care of the problem (fingers crossed).
I am sorry that I can not give a more detailed description (eg where
the problem exactly is), but most of the perl code is still beyond
me...
But maybe somebody has an idea as to where the problem might be.
Gerd Knops
corrupts the memory, down to double typed SV's. I tried to use an
SV as a blessed reference and as an integer value, using the
following code:
rv=sv_2mortal(newSViv((IV)obj));
SvRV(rv)=hv;
SvROK_on(rv);
sv_bless(rv,stash);
(void)SvIOK_on(rv);
To make debugging almost impossible, hv in the above example is a
reference to a hash tied to another blessed sv (using magic). I also
used OVERLOAD on the resulting object (rv in the above code). For a
while everything worked just fine, but with growing testcode I run
into serious problems with corrupted memory. Debugging was a
nightmare, since with every change in code the problem would appear
at another place or not at all. Removing the double typing finally
seems to have taken care of the problem (fingers crossed).
I am sorry that I can not give a more detailed description (eg where
the problem exactly is), but most of the perl code is still beyond
me...
But maybe somebody has an idea as to where the problem might be.
Gerd Knops