[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: memory issue with perl scripts not solved in 1.7.8
On 2001.06.23 00:44:55 +1000 Lloyd Williams wrote:
> > As I mentioned before, there is an issue with memory not being freed
> > when unloading all scripts (/unloadall). Since no one answered to my
> > previous posting about this, I decided to just wait for 1.7.8... Now
> > it's here, but the issue is still unsolved.
> > Here are results of a simple test, starting xchat, seeing how much
> > memory it takes, then loading and unloading a Perl script 20 times,
> then
> > seeing again how much memory it takes, then exiting xchat and memory
> > info again. Test was performed on an x86 box running Linux RedHat 7.1
> > with kernel 2.4.5. The script used for testing was Atheism-v2.0 (which
> > is available at http://atheism-v2.sf.net)
> <snip>
>
> This mem leak seems to be on Perl's part, /UNLOADALL simply has Perl
> destroy, free and re-create the PerlInterpreter structure, but Perl's
> destroy/free code doesn't free it all.
> Other than that I don't know.
>
> On a side note, there seems to be a leak with the pop-up menu in the text
> area, xchat grows by about 70-80KB every time the pop-up menu is created.
Here's a quote from perlembed man-page.
---------------------------------------------------------------------
The program must take care to ensure that this takes place
before the next interpreter is constructed. By default,
when perl is not built with any special options, the
global variable "PL_perl_destruct_level" is set to "0",
since extra cleaning isn't usually needed when a program
only ever creates a single interpreter in its entire life
time.
Setting "PL_perl_destruct_level" to "1" makes everything
squeaky clean:
PL_perl_destruct_level = 1;
while(1) {
....
/* reset global variables here with PL_perl_destruct_level = 1
*/
perl_construct(my_perl);
...
/* clean and reset _everything_ during perl_destruct */
perl_destruct(my_perl);
perl_free(my_perl);
...
/* let's go do it again! */
}
-------------------------------------------------------------------
It sounds like the answer, but when you try to do it, it segfaults just
nicely.
The popup menus leak is a nasty one! I thought gtk destroys popup menus
when
they disappear, but apparently not, they are still hanging around, hidden.
Patch attached.
--
Peter Zelezny. <zed@linux.com>
menuleak.diff.gz