https://issues.dlang.org/show_bug.cgi?id=16457
--- Comment #2 from greenify <[email protected]> --- thanks a lot for looking at this so quickly :) > The problem is enum re = ... line. Enum means ctRegex!`((c)(s)?)?ti` is > copy-pasted at the place of usage, basically reconstructing regex on each > loop iteration b/c compile-time version can't cache compiled patterns. Okay that makes partially sense, but to give some background I found this problem because the D changelog generation crashed on my machine (16G) while parsing a 300kB log file. The dummy file is a dustmited & reduced version of the changelog generator: https://github.com/dlang/tools/blob/master/changed.d#L77 And using `enum ... = ctRegex!...` seems to be a very common pattern: https://github.com/search?q=enum+ctRegex&type=Code&utf8=%E2%9C%93 > Replace enum with static and all should be good. Unfortunately I can still observe the same behavior, I also tried to move ctRegex to the matchAll. Funnily with regex I don't get this allocation / out of memory -problem. FYI static immutable doens't work: foo.d(10): Error: template std.regex.matchAll cannot deduce function from argument types !()(string, immutable(StaticRegex!char)), candidates are: /usr/include/dlang/dmd/std/regex/package.d(860): std.regex.matchAll(R, RegEx)(R input, RegEx re) if (isSomeString!R && is(RegEx == Regex!(BasicElementOf!R))) /usr/include/dlang/dmd/std/regex/package.d(868): std.regex.matchAll(R, String)(R input, String re) if (isSomeString!R && isSomeString!String) /usr/include/dlang/dmd/std/regex/package.d(875): std.regex.matchAll(R, RegEx)(R input, RegEx re) if (isSomeString!R && is(RegEx == StaticRegex!(BasicElementOf!R))) --
