Hi Trizor, Many thanks for your reply - alas this did not seem to fix the leak. The code I have now is:
#include <EXTERN.h> #include <perl.h> static PerlInterpreter *my_perl; main (int argc, char **argv, char **env) { STRLEN n_a; int i; char *embedding[] = { "", "-e", "sub fred {1;};" }; my_perl = perl_alloc(); perl_construct( my_perl ); perl_parse(my_perl, NULL, 3, embedding, NULL); perl_run(my_perl); for(i=0; i < 10000000; i++) { SvREFCNT_dec(eval_pv("1;", TRUE)); } perl_destruct(my_perl); perl_free(my_perl); }
and compiled with perl 5.8.3 still leaks. In a previous attempt (before I posted) I tried assigning the eval_pv() to an SV* and explicitly calling SV_free on it (and also setting it mortal with sv_2motral) but neither of these helped. I was coming to the conclusion that the leak may be inside eval_pv/sv iteself so I thought I'd post here to see if anyone else had seen similar issues. I guess the thing to try next is to build the latest 5.8.8 perl and try it with that. Many thanks, Shaun.

In reply to Re^2: memory leak in eval_pv? by lightspeed
in thread memory leak in eval_pv? by lightspeed

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.