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

Empty array reference in a loop leaks memory on rakudo-parrot #3283

Closed
p6rt opened this issue Nov 27, 2013 · 12 comments
Closed

Empty array reference in a loop leaks memory on rakudo-parrot #3283

p6rt opened this issue Nov 27, 2013 · 12 comments

Comments

@p6rt
Copy link

p6rt commented Nov 27, 2013

Migrated from rt.perl.org#120638 (status was 'resolved')

Searchable as RT120638$

@p6rt
Copy link
Author

p6rt commented Nov 27, 2013

From @moritz

This script by raydiak on #perl6 leaks memory on perl6-p​:

#!/usr/bin/env perl6

use v6;

my $mem = 0;
sub report_memory () {
  my $next_mem = qqx[ps -p $*PID -o size=]+0;
  printf "%+8d = %8d K\n", $next_mem-$mem, $next_mem;
  $mem = $next_mem;
}

for ^1e5 {
  [];
  report_memory unless $_ % 1e3;
  Nil;
}

$ ./perl6-p mem.p6
  +454104 = 454104 K
  +797624 = 1251728 K
  +806496 = 2058224 K
  +51788 = 2110012 K
  +0 = 2110012 K
  +698396 = 2808408 K
Error executing process​: Cannot allocate memory
  in sub QX at gen/parrot/CORE.setting​:734
  in sub report_memory at mem.p6​:7
  [...]

Removing the []; greatly reduces the leak (mostly to noise). It doesn't
leak on the JVM backend.

@p6rt
Copy link
Author

p6rt commented Nov 27, 2013

From @moritz

Valgrind to the rescue​:

09​:46 < FROGGS> ==6371== 1,115,200,000 bytes in 1,394 blocks are still
  reachable in loss record 2,271 of 2,271
09​:46 < FROGGS> ==6371== by 0x9212F4A​: Parrot_QRPA_set_integer_native
  (qrpa.c​:827)

@p6rt
Copy link
Author

p6rt commented Nov 27, 2013

From @pmichaud

I have a strong suspicion that this bug is related to
parrot/parrot#795 . As demonstrated
in that issue, Parrot tends to gobble up all available memory
even in a simple case of allocating and releasing an array,
and once the process is at the edge of its memory allocation
limits various panics can easily ensure.

It might very well be something else, but I just wanted to
point out the known issue with Parrot's GC in this context.

Pm

@p6rt
Copy link
Author

p6rt commented Nov 27, 2013

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Mar 12, 2015

From @usev6

I've run the script mem.p6 on with a current rakudo.moar and rakudo.jvm and with rakudo.parrot from Rakudo Star 2015.02. On neither backend there is a severe memory leak (cmp. attached files moar.txt, jvm.txt, parrot.txt).

So, is this ticket closable?

@p6rt
Copy link
Author

p6rt commented Mar 12, 2015

From @usev6

+2437004 = 2437004 K
  +0 = 2437004 K
  +0 = 2437004 K
  +0 = 2437004 K
  +0 = 2437004 K
  +0 = 2437004 K
  +25940 = 2462944 K
  +3352 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K
  +0 = 2466296 K

@p6rt
Copy link
Author

p6rt commented Mar 12, 2015

From @usev6

  +85228 = 85228 K
  +584 = 85812 K
  +2704 = 88516 K
  +12 = 88528 K
  +2904 = 91432 K
  +4 = 91436 K
  +4 = 91440 K
  +388 = 91828 K
  +20 = 91848 K
  +0 = 91848 K
  +4 = 91852 K
  +364 = 92216 K
  +4 = 92220 K
  +0 = 92220 K
  +220 = 92440 K
  +0 = 92440 K
  +0 = 92440 K
  +8 = 92448 K
  +152 = 92600 K
  +0 = 92600 K
  +0 = 92600 K
  +520 = 93120 K
  +0 = 93120 K
  +240 = 93360 K
  +0 = 93360 K
  +0 = 93360 K
  +8 = 93368 K
  +344 = 93712 K
  +4 = 93716 K
  +4 = 93720 K
  +16 = 93736 K
  +4 = 93740 K
  +208 = 93948 K
  +4 = 93952 K
  +0 = 93952 K
  +0 = 93952 K
  +0 = 93952 K
  +160 = 94112 K
  +0 = 94112 K
  +308 = 94420 K
  +0 = 94420 K
  +136 = 94556 K
  +0 = 94556 K
  +0 = 94556 K
  +0 = 94556 K
  +0 = 94556 K
  +324 = 94880 K
  +0 = 94880 K
  +388 = 95268 K
  +0 = 95268 K
  +20 = 95288 K
  +0 = 95288 K
  +0 = 95288 K
  +216 = 95504 K
  +8 = 95512 K
  +200 = 95712 K
  +0 = 95712 K
  +8 = 95720 K
  +0 = 95720 K
  +0 = 95720 K
  +0 = 95720 K
  +0 = 95720 K
  +416 = 96136 K
  +0 = 96136 K
  +0 = 96136 K
  +140 = 96276 K
  +0 = 96276 K
  +252 = 96528 K
  +0 = 96528 K
  +0 = 96528 K
  +0 = 96528 K
  +0 = 96528 K
  +132 = 96660 K
  +0 = 96660 K
  +212 = 96872 K
  +0 = 96872 K
  +136 = 97008 K
  +0 = 97008 K
  +0 = 97008 K
  +0 = 97008 K
  +0 = 97008 K
  +360 = 97368 K
  +0 = 97368 K
  +204 = 97572 K
  +0 = 97572 K
  +0 = 97572 K
  +0 = 97572 K
  +0 = 97572 K
  +196 = 97768 K
  +0 = 97768 K
  +188 = 97956 K
  +0 = 97956 K
  +0 = 97956 K
  +140 = 98096 K
  +0 = 98096 K
  +0 = 98096 K
  +0 = 98096 K
  +328 = 98424 K
  +0 = 98424 K
  +0 = 98424 K

@p6rt
Copy link
Author

p6rt commented Mar 12, 2015

From @usev6

+265784 = 265784 K
  +36484 = 302268 K
  +2508 = 304776 K
  +26752 = 331528 K
  +60892 = 392420 K
  +6684 = 399104 K
  +0 = 399104 K
  +0 = 399104 K
  +280 = 399384 K
  +0 = 399384 K
  +0 = 399384 K
  +7628 = 407012 K
  +0 = 407012 K
  +0 = 407012 K
  +0 = 407012 K
  +1584 = 408596 K
  +0 = 408596 K
  +0 = 408596 K
  +0 = 408596 K
  +0 = 408596 K
  +0 = 408596 K
  +1244 = 409840 K
  +0 = 409840 K
  +0 = 409840 K
  +0 = 409840 K
  +3168 = 413008 K
  +0 = 413008 K
  +0 = 413008 K
  +0 = 413008 K
  +0 = 413008 K
  +0 = 413008 K
  +7484 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +0 = 420492 K
  +4472 = 424964 K
  +0 = 424964 K
  +0 = 424964 K
  +0 = 424964 K
  +264 = 425228 K
  +0 = 425228 K
  +0 = 425228 K
  +0 = 425228 K
  +0 = 425228 K
  +0 = 425228 K
  +3740 = 428968 K
  +0 = 428968 K
  +0 = 428968 K
  +0 = 428968 K
  +1320 = 430288 K
  +0 = 430288 K
  +0 = 430288 K
  +0 = 430288 K
  +0 = 430288 K
  +0 = 430288 K
  +1452 = 431740 K
  +0 = 431740 K
  +0 = 431740 K
  +0 = 431740 K
  +2640 = 434380 K
  +0 = 434380 K
  +0 = 434380 K
  +0 = 434380 K
  +0 = 434380 K
  +0 = 434380 K
  +0 = 434380 K
  +0 = 434380 K
  +0 = 434380 K
  +0 = 434380 K
  +4092 = 438472 K
  +0 = 438472 K
  +0 = 438472 K
  +0 = 438472 K
  +0 = 438472 K
  +0 = 438472 K
  +0 = 438472 K
  +0 = 438472 K
  +0 = 438472 K
  +0 = 438472 K
  +4412 = 442884 K
  +0 = 442884 K
  +0 = 442884 K
  +0 = 442884 K
  +1056 = 443940 K
  +0 = 443940 K
  +0 = 443940 K
  +0 = 443940 K
  +0 = 443940 K
  +0 = 443940 K
  +3296 = 447236 K

@p6rt
Copy link
Author

p6rt commented Mar 12, 2015

From @usev6

I've run the script mem.p6 on with a current rakudo.moar and rakudo.jvm and with rakudo.parrot from Rakudo Star 2015.02. On neither backend there is a severe memory leak (cmp. attached files moar.txt, jvm.txt, parrot.txt).

So, is this ticket closable?

@p6rt
Copy link
Author

p6rt commented Jan 12, 2016

From @coke

On Thu Mar 12 08​:56​:50 2015, bartolin@​gmx.de wrote​:

I've run the script mem.p6 on with a current rakudo.moar and
rakudo.jvm and with rakudo.parrot from Rakudo Star 2015.02. On neither
backend there is a severe memory leak (cmp. attached files moar.txt,
jvm.txt, parrot.txt).

So, is this ticket closable?

Yes, thanks.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 13, 2016

From @usev6

On Tue Jan 12 06​:35​:56 2016, coke wrote​:

[...]

So, is this ticket closable?

Yes, thanks.

Great. I'm closing the ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Jan 13, 2016

@usev6 - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jan 13, 2016
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