Bug 16626 – [Reg 2.073] extreme CTFE memory usage with compile time regex
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-10-19T23:01:00Z
Last change time
2017-01-17T11:24:44Z
Keywords
pull
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2016-10-19T23:01:38Z
Building a debug tests of Higgs[¹] doesn't finish building and runs out of memory with dmd-2016-10-10 (v2.073.0-master-9a935f6). Only takes about 2GB with dmd-2016-10-09 (v2.073.0-master-321c95e).
According to verbose output it hangs at `semantic3 parser`.
Digger says it's caused by https://github.com/dlang/phobos/pull/4286.
[¹]: https://github.com/higgsjs/Higgs
Comment #1 by code — 2016-10-19T23:07:58Z
Seems to happen for 2 ctRegex to filter out non-alphanumerical characters.
auto nonAlnum = ctRegex!(`[^\w]`w);
enum notAlnum = ctRegex!(`[^0-9|a-z|A-Z]`, "g");
Comment #2 by code — 2016-10-23T22:50:13Z
From Dmitry https://github.com/dlang/phobos/pull/4286#issuecomment-255182046
> The new version is more demanding on memory during CTFE so yeah, most likely it now fails for some patterns. Dunno what to do here would really love to see the new engine sometime soon.
That might still take a while and in the meantime such simple ctRegex eat up 16GiB (kill my project tester https://ci.dawg.eu/ btw).
If we can't really support the NFA kickstarter in CTFE, then we should just disable it for now.