Bug 2936 – std.regex.match() short string optimization
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-05-04T21:39:00Z
Last change time
2015-06-09T01:26:26Z
Keywords
performance
Assigned to
dmitry.olsh
Creator
dsimcha
Comments
Comment #0 by dsimcha — 2009-05-04T21:39:19Z
The following example program leaks memory like a sieve (because the GC is disabled). Apparently, std.regex.match() is not supposed to perform heap allocations.
import std.regex, core.memory;
void main() {
string s = "This is only a test. Repeat, this is only a test.";
auto r = regex("is.only");
GC.disable;
while(true) {
auto m = match(s, r);
}
}