Thread overview
[Issue 7928] New: Regex regression - out of memory.
Apr 16, 2012
Vincent
Apr 17, 2012
Dmitry Olshansky
Apr 17, 2012
Vincent
Apr 17, 2012
Dmitry Olshansky
Apr 17, 2012
Vincent
Apr 19, 2012
Dmitry Olshansky
April 16, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7928

           Summary: Regex regression - out of memory.
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: thornik@gmail.com


--- Comment #0 from Vincent <thornik@gmail.com> 2012-04-16 12:49:02 PDT ---
I had working program with reg.exp. for parsing HTTP requests:
regex(`^(\w+)\s+((\w+)://([^/]+)(\S+))\s*(.*)`)

From some D2 version program stopped compiling with exception "out of memory".
More simpler expression compiles fine: regex(`^([-a-zA-Z]+):\s*(.*)`);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7928


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh@gmail.com


--- Comment #1 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-04-16 23:27:27 PDT ---
Works for me on 2.059. It might be the case that you use ctRegex then it very well may run out of memory because of Issue 1382.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7928



--- Comment #2 from Vincent <thornik@gmail.com> 2012-04-17 00:16:55 PDT ---
> It might be the case that you use ctRegex...

Function 'regex' returns Regex object, not ctRegex. BUT my feeling is that long compiling of my small program caused by 'compile time Regex'! Probably some trick in library makes all Regex as 'compile time'?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7928



--- Comment #3 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-04-17 00:20:35 PDT ---
Aha, I think I know what it is! Give me the prize ;)

Don't you have globals defined like this?

auto httpReqRegex = regex(`^(\w+)\s+((\w+)://([^/]+)(\S+))\s*(.*)`);

then it tries to init it at compile time. That makes it _parse_ them all at CTFE.

Nice feature if it wasn't for bugs. The workaround is to init them in the
module constructor static this(){ ... )

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7928



--- Comment #4 from Vincent <thornik@gmail.com> 2012-04-17 00:49:18 PDT ---
(In reply to comment #3)
> Aha, I think I know what it is! Give me the prize ;)
> Don't you have globals defined like this?

Yep, OF COURSE I made 'em global! Take your prize:
(*)(*)
(tits) :)))

Damn... what a hell that CTFE meddle into my code when I didn't ask for it??

> The workaround is to init them in the module constructor static this(){ ... )

Thanks, Dmitry! Will use it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7928


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #5 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-04-19 08:53:00 PDT ---
Ok I'm marking this as duplicate of 7442 as it is the root of problem with 'Out of memory on static regex' even if static-ness wasn't intended.

*** This issue has been marked as a duplicate of issue 7442 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------