in reply to memory leak with embedded perl

There's no advantage to globals over lexicals in terms of memory used. You could try undef'ing your variables at the end of your routine.

Replies are listed 'Best First'.
Re: Re: memory leak with embedded perl
by mr_mischief (Monsignor) on Dec 18, 2001 at 09:16 UTC
    I tried that already to no avail. I know little enough about the perl core that the idea of running Purify or ElectricFence over it embedded in another program makes flashbacks to some of the smaller auto accidents in which I've been involved seem like falling off the couch laughing. There must be something that's causing the leaks, but I have limited time and desire to find it myself. As much as I dislike the idea of using cron to relaunch the program or putting an exec() loop in the server daemon, I'm afraid those are starting to look like my options.

    Actually, I think if I exit the Perl program that get loaded, the embedded perl gets chucked and reinitialized. Perhaps that would be my best bet. Still, if anyone has any suggestions which would lead to a cleaner solution, I'd love to know.
      Honestly, things like this are very often due to something in your code. Why don't you try posting the smallest example you can create that still leaks and let people look at it? You might find the problem just by pulling bits out if it until it stops leaking.