-
Notifications
You must be signed in to change notification settings - Fork 531
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
call_argv
fails to call SAVETMP
/FREETMP
when creating mortal argument
#22255
Comments
Yeah that should honor |
True, a reference-counted stack should solve the issue in the future, but there is a lot of existing third-party code out there that isn't going to be rc-aware any time soon, so this should either be addressed for non-rc stacks too, or (less-desirably) the docs should be updated to explicitly say that |
We can only do this clean up for G_DISCARD since otherwise we might free the return values on the stack. Fixes Perl#22255
We can only do this clean up for G_DISCARD since otherwise we might free the return values on the stack. Fixes Perl#22255
We can only do this clean up for G_DISCARD since otherwise we might free the return values on the stack. Fixes Perl#22255
We can only do this clean up for G_DISCARD since otherwise we might free the return values on the stack. Fixes Perl#22255
We can only do this clean up for G_DISCARD since otherwise we might free the return values on the stack. Fixes #22255
Module: perl core
Description
When calling
call_argv
in the way shown in theperlembed
documentation, the C string argument(s) are converted to mortal SVs and pushed onto the stack, however this operation is not wrapped inSAVETMP
/FREETMP
markers, so the mortal SVs are not garbage-collected. If this is done in an embedded perl interpreter, even withG_DISCARD
enabled, the uncollected garbage will accrue indefinitely.Steps to Reproduce
Compile and run this example and observe the differences in allocated memory for the scoped and raw
call_argv
loops for various iteration-counts.Compiling, running, and output:
Expected behavior
I expect garbage-collection to recover the mortal SVs so that the program can continue to invoke
call_argv
indefinitely without increasing memory usage.Perl configuration
The text was updated successfully, but these errors were encountered: