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

chapter_08 #23

Open
augensalat opened this issue Oct 10, 2015 · 7 comments
Open

chapter_08 #23

augensalat opened this issue Oct 10, 2015 · 7 comments

Comments

@augensalat
Copy link

First of all: Many thanks for this great tutorial.

Unfortunately the last chapter is not complete. Moreover the example code is broken.

  • The code found in xs-fun/chapter_08/Audio-Chromaprint is not fully covered by chapter_08.pod
  • t/leak-pointer is broken. When I run it with default values of Test::MemoryGrowth (10/10000) I get
t/leak-pointer.t .. 
1..2
ok 1 - use Audio::Chromaprint;
not ok 2 - Does not grow in memory

#   Failed test 'Does not grow in memory'
#   at t/leak-pointer.t line 11.
# Lost 344064 bytes of memory over 10000 calls, average of 34.41 per call
# Looks like you failed 1 test of 2.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests 
@paultcochrane
Copy link
Collaborator

Thanks for the bug report. Unfortunately, I can't reproduce the problem. What platform are you on? If you're on Linux, which distribution (and version thereof) are you using? Which version of perl are you using (the output of perl --version should be sufficient)? Is it a perlbrewed Perl version or the system perl? Sorry for the many questions! Nevertheless, I'd like to get to the bottom of this issue.

As far as the chapter text is concerned, if I recall correctly, @xsawyerx made the comment at a conference recently that he's thinking of reworking this chapter, and I have a feeling that it's a known issue that the chapter isn't yet complete.

@augensalat
Copy link
Author

Hi Paul,

it is Linux 64bit and perlbrew and it fails on each Perl dist (each 64bit) so far, which was 5.14.0 w/ threads, 5.14.1 w/o threads, 5.16.2 w/o threads and 5.22.0 w/o threads.

I found the setting 100/100 for Test::MemoryGrowth suspicious, and indeed it worked for that number, but not when I run with a more reasonable setting like the default 10/10000.

Did you also run you test with Test::MemoryGrowth default?

@paultcochrane
Copy link
Collaborator

No, I simply ran the test suite. However, after I changed the number of calls to 10000 and the burn in setting to 10 (or even 100), I'm able to reproduce your results. Thanks for pointing out this issue we'll need to look into it a bit more.

@xsawyerx: was there a reason you chose calls => 100, burn_in => 100 for the leak-pointer test?

@augensalat
Copy link
Author

Afaik Perl reserves system memory in bigger chunks. With just 100 calls the leaked memory seems to stay below the threshold before Perl must reserve the next chunk.

@xsawyerx
Copy link
Owner

No reason it was exactly 100. I just wanted something that didn't take very long. Let's raise and try to fix any problem we see.

@xsawyerx
Copy link
Owner

I tested with 1,000 for both burn_in and calls and then I can reproduce the failure:

$ perl -Mblib -Ilib t/leak-pointer.t
1..2
ok 1 - use Audio::Chromaprint;
not ok 2 - Does not grow in memory
#   Failed test 'Does not grow in memory'
#   at t/leak-pointer.t line 11.
# Lost 118784 bytes of memory over 1000 calls, average of 118.78 per call
# Looks like you failed 1 test of 2.

I'm going to review the chapter now and clean up the code first. Then we'll see if the code still leaks and try to address that.

Thanks again for opening the ticket. :)

@xsawyerx
Copy link
Owner

This doesn't seem to happen every time I run the test. I'm not sure why it's sporadic.

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

3 participants