I'm having a problem with some XS that is some kind of perl stack issue. It doesn't always happen in the same XSUB, but I always get a usage error from the XSUB when it happens. The fact that it doesn't happen in the same XSUB means I don't know what code is causing it, so I can't supply code.

In one case, I have CPP code calling a method on a perl object; I have provided a base class with a default XS version of that method. If I don't provide that method in my subclass, the error can actually happen without going to Perl code at all.

I am able to reproduce the error, and so I examined the items variable (by altering the c file generated from the XS and then recompiling), and it was negative. However, these are method calls (but not always from the same class), so the blessed reference HAS to be on the stack, or Perl wouldn't have called the XSUB in the first place.

Since this is XS, my first thought is that I've messed up refcounts and mortality. But would that affect the items variable? What else might be the problem?


In reply to Perl stack issue by jalopeura

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.