Re: perl_parse memory leak with dynamic loaded modules

[email protected] (Reini Urban)
Newsgroups perl.xs
Message-ID <[email protected]>
James Shirley schrieb:
> Hi, I'm trying to write a persistent perl daemon, but have noticed what
> looks like a memory leak, with perl_parse.
>
> It only seems to occur once dynamic loading of perl modules is enabled,
> here is my test kit:
...
> # ./showtime -e "use Time::HiRes;" &
> # watch -d ps u $!
>
> Notice RSS size keeps on getting larger, 20k/sec
> Works with other modules aswell
> I've run valgrind over it, and it cannot find any memory leaks..
> Any help would be much appreciated..

I believe DynaLoader:dl_unload_file is never called implicitly in the 
module destructor, so you have to do that manually.

something like:
record the so in your object, and
sub DESTROY {
   DynaLoader::dl_unload_file($shift->your_so)
     if defined (&DynaLoader::dl_unload_file);
}
-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.