Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: MemLeak in Perl from C Calls

by kal (Hermit)
on Apr 24, 2001 at 14:39 UTC ( #75007=note: print w/replies, xml ) Need Help??

in reply to MemLeak in Perl from C Calls

Stefan, have you tried PL_perl_destruct_level = 1; before the loop? It's a global, documented in perlembed.

Replies are listed 'Best First'.
Re: Re: MemLeak in Perl from C Calls
by stefan k (Curate) on Apr 24, 2001 at 15:00 UTC
    Thanks for your guess, but it's still growing and growing in top :((

    I tried it at the beginning of main and right before the while-statement...

    Any other ideas?

    Regards Stefan K

      No, as you say, you're using it pretty much as documented. Probably the best thing to do will be to keep the interpreter hanging around, and call perl_eval_ev() more than once - so in your loop, you get rid of the perl_construct/destruct, and put them outside the loop. That way, the memory you leak is constant, rather than proportional to the number of times you have looped. Not a fix, but a solution nonetheles...

        Hi kal,
        first: thanks for your efforts!

        I tried this and the leak became invisible. But then I found that if you'd take away the sleep(1) it still grows.
        As a matter of fact: with the perl interpreter intitialising stuffed into main it grows only every 30 calls or something like that -> ?!?!

        Just to be sure I removed the call_perl()-statement from the loop and it didn't leak...

        Regards Stefan K

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://75007]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2022-11-30 18:23 GMT
Find Nodes?
    Voting Booth?