# New Ticket Created by  Moritz Lenz 
# Please include the string:  [perl #120638]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=120638 >


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.

Reply via email to