D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2936 - std.regex.match() short string optimization
Summary: std.regex.match() short string optimization
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 enhancement
Assignee: Dmitry Olshansky
URL:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2009-05-04 21:39 UTC by David Simcha
Modified: 2015-06-09 01:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2009-05-04 21:39:19 UTC
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);
    }
}
Comment 1 Andrei Alexandrescu 2011-06-05 07:51:13 UTC
Reassigning to Dmitry.
Comment 2 Dmitry Olshansky 2011-12-09 11:45:53 UTC
Fixed in new std.regex