# New Ticket Created by Zoffix Znet # Please include the string: [perl #127135] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=127135 >
Consider this code that is missing the second argument for .subst-mutate method and the error it generates: <Zoffix> m: my $foo = '42'; $foo.subst-mutate: /^'ba'/; <camelia> rakudo-moar b5cb00: OUTPUT«Memory allocation failed; could not allocate 19776 bytes» What's happening is instead of getting the .subst-mutate from Str type, the missing arg causes us to get the one from Cool type: https://github.com/rakudo/rakudo/blob/8c001e0a8fc4aacc93eb4327d30071b00f9699fa/src/core/Cool.pm#L267 The Cool then stringifies the argument and attempts to call .subst-mutate again, with same args, restarting the infinite loop: https://github.com/rakudo/rakudo/blob/8c001e0a8fc4aacc93eb4327d30071b00f9699fa/src/core/Cool.pm#L273 The number of args in Cool should be detected and error generated.