memory leak I think.
I've been running a perl6 program that runs through a loop, dumps intermediate results and starts again with new initialisation values. The program runs fine for the first three loops, but does appear to slow down and on the fourth time though hangs. Looking at system resources, the program chews up memory resources continually. a) Is this a known problem due to garbage collection problems? b) Is there a work around to actually release re-initialise objects. For instance, I use several arrays and I reinitialised by setting (in a reset method of a class) @.rray = (); Does this work? c) Is there a better way to find the source of the problem than running the program and looking at system resources? Eg. valgrind? I'm not sure how to use this with perl6. Richard
Unexpected expansion of string with xx
Initially I though the following was a bug, but now I'm not sure. I got these results perl6 -v This is perl6 version 2013.09 built on parrot 5.5.0 revision 0 $ perl6 > say '0' xx 4 0 0 0 0 > print '0' xx 4 > print 's' ~ ('0' xx 4) s0 0 0 0> I'm not sure why the elements of the expansion are padded with a trailing space in one context but not in another. I wasn't sure whether this is the specified behaviour. If it is how can it be turned off? Richard
Re: Unexpected expansion of string with xx
On 12/19/2013 3:47, Richard Hainsworth wrote: Initially I though the following was a bug, but now I'm not sure. I got these results perl6 -v This is perl6 version 2013.09 built on parrot 5.5.0 revision 0 $ perl6 > say '0' xx 4 0 0 0 0 Are you sure you didn't want the x (string repetition) operator, instead of xx (list repetition)? > print '0' xx 4 > print 's' ~ ('0' xx 4) s0 0 0 0> I'm not sure why the elements of the expansion are padded with a trailing space in one context but not in another. print calls .Str, say calls .gist. I wasn't sure whether this is the specified behaviour. It is. If it is how can it be turned off? Call .Str or .gist on the argument to print/say as needed. I suspect that the problem will be resolved by using the x operator instead of xx, however. :-) /jnthn
Re: memory leak I think.
On Thu, Dec 19, 2013 at 11:27:32AM +0800, Richard Hainsworth wrote: > I've been running a perl6 program that runs through a loop, dumps > intermediate results and starts again with new initialisation > values. > [...] > Looking at system resources, the program chews up memory resources > continually. > > a) Is this a known problem due to garbage collection problems? If you're using Rakudo on Parrot, then the likely cause of what you are seeing is due to the way Parrot manages memory. Parrot tends to allocate memory pools up to a certain limit (based on system resources) and never releases any of that allocated memory back to the system until the process terminates. So even though Rakudo is likely releasing the resources back to Parrot, Parrot doesn't release them back to the system. Parrot will start re-using the allocated memory for new objects, however, once it's reached the resource limit mentioned above. Pm
Re: Unexpected expansion of string with xx
OK x not xx. The doubling of operators is confusing. Richard On 12/19/2013 10:01 PM, Jonathan Worthington wrote: On 12/19/2013 3:47, Richard Hainsworth wrote: Initially I though the following was a bug, but now I'm not sure. I got these results perl6 -v This is perl6 version 2013.09 built on parrot 5.5.0 revision 0 $ perl6 > say '0' xx 4 0 0 0 0 Are you sure you didn't want the x (string repetition) operator, instead of xx (list repetition)? > print '0' xx 4 > print 's' ~ ('0' xx 4) s0 0 0 0> I'm not sure why the elements of the expansion are padded with a trailing space in one context but not in another. print calls .Str, say calls .gist. I wasn't sure whether this is the specified behaviour. It is. If it is how can it be turned off? Call .Str or .gist on the argument to print/say as needed. I suspect that the problem will be resolved by using the x operator instead of xx, however. :-) /jnthn