-
Notifications
You must be signed in to change notification settings - Fork 558
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
Memory leaks in threaded Perl (cloning PVGVs and PL_my_cxt_list) #10540
Comments
From jirka@fud.czCreated by jirka@fud.czHi all, I would like to report two memory leaks in the threaded Perl First problem is in S_sv_dup_common() [sv.c] - in the 2nd switch, The second issue deals with PL_my_cxt_list. As I understood, Patch with my modifications against blead Perl from git should The problem can be easily replicated using the following command: After the patch: I hope my report is OK and will help to improve Perl. Best regards, Perl Info
|
From jirka@fud.czithreads-clone-leaks.patchdiff --git a/sv.c b/sv.c
index c9ab89e..a882034 100644
--- a/sv.c
+++ b/sv.c
@@ -11306,8 +11306,7 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const param)
Perl_sv_add_backref(aTHX_ MUTABLE_SV(GvSTASH(dstr)), dstr);
GvGP(dstr) = gp_dup(GvGP(sstr), param);
(void)GpREFCNT_inc(GvGP(dstr));
- } else
- Perl_rvpv_dup(aTHX_ dstr, sstr, param);
+ }
break;
case SVt_PVIO:
/* PL_parser->rsfp_filters entries have fake IoDIRP() */
diff --git a/perl.c b/perl.c
index 57be5d2..ff1c94f 100644
--- a/perl.c
+++ b/perl.c
@@ -1070,6 +1070,9 @@ perl_destruct(pTHXx)
Perl_ck_warner_d(aTHX_ packWARN(WARN_INTERNAL),"Unbalanced context: %ld more PUSHes than POPs\n",
(long)cxstack_ix + 1);
}
+
+ /* Not ideal, doesn't care about contents, but better than nothing */
+ Safefree(PL_my_cxt_list);
/* Now absolutely destruct everything, somehow or other, loops or no. */
|
From @iabynOn Sat, Aug 21, 2010 at 08:02:14PM -0700, Jirka Hruška wrote:
Fix looks good thanks, applied as commit with minor comment tweaks
The contents don't need to be freed as they point to the PVX fields -- |
The RT System itself - Status changed from 'new' to 'open' |
@iabyn - Status changed from 'open' to 'resolved' |
From jirka@fud.czDave,
|
Migrated from rt.perl.org#77352 (status was 'resolved')
Searchable as RT77352$
The text was updated successfully, but these errors were encountered: