Skip to content

Conversation

@niner
Copy link
Contributor

@niner niner commented Mar 25, 2020

When Dumper was called without arguments and in list context it leaked the
preallocated retval scalar.

@jkeenan
Copy link
Contributor

jkeenan commented Mar 25, 2020

When Dumper was called without arguments and in list context it leaked the
preallocated retval scalar.

How could one observe this leakage?

When Dumper was called without arguments and in list context it leaked the
preallocated retval scalar: perl -MData::Dumper -e '() = Dumper while 1'
@niner niner force-pushed the fix_dumper_memory_leak branch from 584e557 to 92b62a2 Compare March 25, 2020 14:01
@niner
Copy link
Contributor Author

niner commented Mar 25, 2020

I added the example to the commit message: perl -MData::Dumper -e '() = Dumper while 1'

@niner
Copy link
Contributor Author

niner commented Mar 25, 2020

All the smoke test failures seem to be because of Data::Dumper's version staying the same despite changes to the source.

@jkeenan
Copy link
Contributor

jkeenan commented Mar 25, 2020

All the smoke test failures seem to be because of Data::Dumper's version staying the same despite changes to the source.

Corrected and pushed for smoking to branch smoke-me/jkeenan/niner/ghpr-17673-dumper-leak.

@Leont
Copy link
Contributor

Leont commented Mar 25, 2020

I think the fix is correct but surprising.

I think it would be clearer to just always create retval as a mortal. That way the right thing happens whether it is pushed or not. Or am I missing something?

@dur-randir
Copy link
Member

I think it would be clearer to just always create retval as a mortal. That way the right thing happens whether it is pushed or not. Or am I missing something?

I felt horrified reading that code. There're two places where it's created, so both should be updated. And there're at least two more problems with this patch's approach:

  • looks like it should unconditionally be freed on the 'else' branch, not under 'imax < 0)'
  • croaking when hit by a style.maxrecursed limit leaks - and creating mortal also helps here

croak("Call to new() method failed to return HASH ref");
if (gimme != G_ARRAY)
XPUSHs(sv_2mortal(retval));
else if (imax < 0) /* Would leak if there was nothing to dump */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is formatted incorrectly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's a tabs vs spaces, the if (gimme... is indented with a tab, while the else is just spaces.

@toddr
Copy link
Member

toddr commented May 19, 2020

Given the leak is not critical, I assume it should not go into 5.32 at this point?

@toddr toddr modified the milestones: 5.32.0, 5.33.1 May 19, 2020
@xsawyerx xsawyerx added the do not merge Don't merge this PR, at least for now label Jun 20, 2020
@jkeenan
Copy link
Contributor

jkeenan commented Jul 17, 2020

Given the leak is not critical, I assume it should not go into 5.32 at this point?

Since 5.33.0 has been released, this ticket is now eligible for further work. Can the contributors take another look?

Thank you very much.
Jim Keenan

@karenetheridge karenetheridge added backport-5.30 dist-Data-Dumper issues in the dual-life blead-first Data-Dumper distribution labels Jul 18, 2020
@toddr toddr added needs-work The pull request needs changes still and removed do not merge Don't merge this PR, at least for now labels Jul 30, 2020
@tonycoz
Copy link
Contributor

tonycoz commented Dec 9, 2020

This was fixed by 4146316

@tonycoz tonycoz closed this Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dist-Data-Dumper issues in the dual-life blead-first Data-Dumper distribution hasConflicts needs-work The pull request needs changes still

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants