New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
leaking sv when perl_clone is used after some code is run #7253
Comments
From stas@stason.orgCreated by stas@rabbit.stason.orgThe followinig problem is reproduced with any 5.8-5.9 w/ithreads. doing the sequence: 1. create perl causes a scalar leak Here is a program to reproduce: /* clone.c */ /* #define TEST "sub foo {}" int main(int argc, char **argv, char **env) PERL_SET_CONTEXT(perl1); perl_parse(perl1, NULL, 3, embedding, (char **)NULL); Perl_eval_pv(perl1, TEST, TRUE); /* loaded only by the first perl */ perl2 = perl_clone(perl1, CLONEf_KEEP_PTR_TABLE); PERL_SET_CONTEXT(perl2); PERL_SET_CONTEXT(perl1); exit(0); The critical part is #define TEST "sub foo {}" which gets eval'ed, the problem doesn't appear if some other code is in ./clone Attempt to free temp My guess is that there is a bug in perl_clone(), and something is not properly Unfortunately I wasn't able to come up with a pure perl example to reproduce If you are interested where the problem was detected, it's obviously under <Perl> Perl Info
|
From @iabynOn Wed, Apr 21, 2004 at 03:17:39AM -0000, Stas Bekman wrote:
(Technically not a leak!) The cause of this is as follows: Of course, there is no 'end of statement' in this code, so in the In your code, when you clone the interpreter, the tmps stack isn't cloned One way to fix this is to add a ENTER/SAVETMPS and FREETMPS/LEAVE Dave.
-- |
The RT System itself - Status changed from 'new' to 'open' |
From stas@stason.orgDave Mitchell via RT wrote:
:) Thanks for the research, Dave!
passing CLONEf_COPY_STACKS indeed fixes the problem. So may be we should pass CLONEf_COPY_STACKS then? Or is it going to perl_clone takes these flags as parameters: CLONEf_COPY_STACKS - is used to, well, copy the stacks also, All I can deduct from this is that if threads->new() don't use it, mod_perl
Well, we can do that locally. The following program works (added the scope #define TEST "sub foo {}" int main(int argc, char **argv, char **env) PERL_SET_CONTEXT(my_perl); perl_parse(my_perl, NULL, 3, embedding, (char **)NULL); perl2 = perl_clone(my_perl, CLONEf_KEEP_PTR_TABLE); PERL_SET_CONTEXT(perl2); PERL_SET_CONTEXT(my_perl); exit(0); If that's the case, there should be a note somewhere, that any perl code -- |
From @iabynstill present in 5.13.4 |
Migrated from rt.perl.org#29018 (status was 'open')
Searchable as RT29018$
The text was updated successfully, but these errors were encountered: