[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: Regex backreference bug in recursion/thread (status & questions)



On Mon, 31 Jan 2000 14:25:21 EST, Harry Wolfson wrote:
>Instead of using the scratchpad to store various bits and pieces of the
>regexp struct, completely regexp-specific memory could be allocated
>_each_ time the MATCH OPcode is entered (no scratchpads involved).
>
>Instead of allocating memory for:
>
>     I32  *startp;
>     I32  *endp;
>
>inside regcomp.c:Perl_pregcomp() using calls to Newz(), it would be put
>off until the MATCH OPcode is entered during runtime. That way
>independent, newly allocated chunks of memory would be used for each
>recursive or thread invocation. Obviously, great care would be required
>to free that memory however the regex happens to exit. The data members
>subbeg and sublen would also need to be modified slightly so that they
>could use this dynamically allocated memory.

Any kind of memory allocation sounds dreadfully expensive. :-)

I think the most one would have to do would be to make a single copy
of the matching porting of the string.  We should be able to avoid
even this copy in most cases.


Sarathy
gsar@ActiveState.com


References to:
Harry Wolfson <HarryWolfson@LL.MIT.EDU>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]