www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7928] New: Regex regression - out of memory.

reply d-bugmail puremagic.com writes:
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



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: -------
Apr 16 2012
next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Apr 16 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7928




 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: -------
Apr 17 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7928




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: -------
Apr 17 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7928





 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: -------
Apr 17 2012
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Apr 19 2012