Skip to content
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

Dumping a filehandle leaks memory [rt.cpan.org #41199] #42

Open
toddr opened this issue May 11, 2017 · 0 comments
Open

Dumping a filehandle leaks memory [rt.cpan.org #41199] #42

toddr opened this issue May 11, 2017 · 0 comments

Comments

@toddr
Copy link
Member

toddr commented May 11, 2017

Migrated from rt.cpan.org#41199 (status was 'stalled')

Requestors:

From [email protected] on 2008-11-25 03:21:22:

This program leaks memory at a high rate:

perl -le 'use YAML::Syck; while (){ open my $fh, "/etc/hosts" or die;
YAML::Syck::Dump($fh)}' > /dev/null

Let me know if you need further details.

Thanks!

From [email protected] on 2008-11-25 09:30:10:

On Mon Nov 24 22:21:22 2008, ANDK wrote:
> This program leaks memory at a high rate:
> 
> perl -le 'use YAML::Syck; while (){ open my $fh, "/etc/hosts" or die;
> YAML::Syck::Dump($fh)}' > /dev/null
> 
> Let me know if you need further details.
> 
> Thanks!

Devel::Leak shows that it's leaking one SV per iteration. The SV dump
looks like this:

new 0x823d6f0 : SV = PVIV(0x823f0c0) at 0x823d6f0
  REFCNT = 1
  FLAGS = (POK,FAKE,READONLY,pPOK)
  IV = 1529493059
  PV = 0x8239a78 "="
  CUR = 1
  LEN = 0

Checking the process memory also suggests that it's only this SV, per
iteration it's leaking about 24 to 28 bytes, depending on perl/OS.

Regards,
    Slaven

From [email protected] on 2010-05-20 11:19:43:

On Mon Nov 24 22:21:22 2008, ANDK wrote:
> This program leaks memory at a high rate:
> 
> perl -le 'use YAML::Syck; while (){ open my $fh, "/etc/hosts" or die;
> YAML::Syck::Dump($fh)}' > /dev/null
> 
> Let me know if you need further details.

A failing test would be nice, you could e.g. run it on linux only and 
check ps -o rss $$, then see if it's e.g. 2x what it used to be after a 
few thousand iterations.

See also this boring form letter I'm pasting around:

(This is a form-reply that isn't specific to your particular report)

YAML::Syck has just acquired one new maintainer (me), it still doesn't
have anyone that *cares* about it. But I'm willing to help solve your
report & release a new version with the fix if it's easy for me.

It now has a Git repository at:

    http://github.com/avar/YAML-Syck

If your report is a patch that fixes a problem, great. Please remake
the patch against Git by forking that repo and sending me a pull
request on GitHub (or an update to this bug if you prefer
git-format-patch(1) or some other repo provider..). Make sure to
include a test for what you fixed.

If your report is some code that fails (and you have a testcase for
it) a patch against the test suite to demonstrate that failure would
be very useful. It's OK if the test crashes and burns, see
Test::More's docs for how to make TODO tests that fail now, but
shouldn't. Even if it segfaults perl C<system $^X => qw/ -Mblib
-MYAML::Syck .../> or something like that and checking the return
value will do.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant