| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since 5.10 (probably 44a2ac759e) named captures have been leaking
memory when they're used, don't actually match, but are later
accessed. E.g.:
$ perl -wle 'for (1..10_000_000) { if ("foo" =~ /(foo|(?<capture>bar))?/) { my $capture = $+{capture} } } system "ps -o rss $$"'
RSS
238524
Here we match the "foo" branch of our regex, but since we've used a
name capture we'll end up running the code in
Perl_reg_named_buff_fetch, which allocates a newSVsv(&PL_sv_undef) but
never uses it unless it's trying to return an array.
Just change that code not to allocate scalars we don't plan to
return. With this fix we don't leak any memory since there's nothing
to leak anymore.
$ ./perl -Ilib -wle 'for (1..10_000_000) { if ("foo" =~ /(foo|(?<capture>bar))?/) { my $capture = $+{capture} } } system "ps -o rss $$"'
RSS
3528
This reverts commit b28f4af8cf94eb18c0cfde71e9625081912499a8 ("Fix
allocating something in the first place is a better solution than
allocating it, not using it, and then freeing it.
|
| |
|
|
|
|
|
|
| |
This one comes from c2123ae38.
And we shouldn’t be suing our mothers’ tykes. :-)
|
|
|
|
|
| |
We don't have to convert from utf8 to code point to fold; instead can
call the function that starts from utf8
|
|
|
|
|
|
| |
Commit 24efd69ba77ba76cd714519dccee88f45820d8b4 introduced a VOL
declaration. I thought I had tested this, but apparently not. It needs
to apply to the pointee instead of the pointer.
|
|
|
|
|
| |
Future commits will change things so that a latin1 character no longer
will go out to disk to load a swash.
|
| |
|
|
|
|
|
|
| |
I believe that there isn't a code path that can screw this up, but one
compiler at least believes otherwise. Declaring it volatile should fix
that.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit that turned up this bug turns out merely exposes an
underlying problem that could be generated via other means.
regcomp.c was looking at the SvUTF8 flag on the input pattern before
doing an SvPV on it. Generally the flag is considered not reliable
unless checked immediately after a SvPV.
I haven't been able to come up with a simple test case that reproduces
the bug. I suspect that XS code is required to trigger it.
|
|
|
|
|
|
| |
The pattern could be tied, for example, and so only want to access it
once. I couldn't come up with a test case that actually exercised this,
but I can think of future changes to regcomp that would.
|
|
|
|
|
|
|
|
|
| |
This bug is a regression in 5.14, in which /[[:lower:]]/i and
/[[:upper:]]/i no longer matched the opposite case.
The fix is to have these use a different table under /i matching, that
includes the correct /i code points. These tables were already
available, just unused.
|
|
|
|
|
|
|
| |
When confronted with something like [[:alpha:]], regcomp.c adds
IsPosixAlpha to the list of properties for code points above 255 to
match against when executing the pattern. The 'Is' is extraneous, and
future commits will not want it.
|
|
|
|
|
| |
Indent the newly formed block, and reflow comments for narrower
available space.
|
|
|
|
|
|
| |
regcomp.c folds the string in these two nodes except in one case.
Change that case to correspond with the predominant behavior. This
enables future optimizations
|
| |
|
|
|
|
|
|
|
|
|
| |
This new function inverts a Unicode property. A regular inversion
doesn't work because it operates on the whole of the code space, and
Unicode property inversions don't invert above-Unicode code points.
This does for inversion lists, what an earlier commit did for swashes.
This function is currently not called by anyone.
|
|
|
|
|
|
| |
This is to guard against misuse of the functions. There is no guard
currently in the underlying Perl functions to lengthening a string
beyond the capacity to hold it.
|
|
|
|
| |
This caused -Uusedl builds to fail
|
|
|
|
|
|
|
|
|
|
|
| |
This function joins multiple EXACT* nodes into a single node.
At the end, under DEBUGGING, it marks the optimised-out nodes as being
type OPTIMIZED. However, some of the 'nodes' aren't actually nodes;
they're random bits of string at the tail of those nodes. So you
can't peek that the 'node's OP field to decide what type it was.
Instead, just unconditionally overwrite all the slots with fake
OPTIMIZED nodes.
|
|
|
|
|
| |
This is in preparation for them to be called from another file. Note
that they are still protected by an #ifdef in embed.fnc.
|
|
|
|
|
|
| |
This is in preparation for it to be called from another file. If
for performance reasons it needs to be made inline again, it could
then be moved into a header.
|
|
|
|
|
|
| |
The names now begin with an underscore to emphasize that they are
for internal use only. This is in preparation for making them
accessible beyond regcomp.c.
|
| |
|
|
|
|
|
| |
The new facilities with inversion lists enables us to do
some more compile-time inversions.
|
|
|
|
| |
This adds inversion, cloning, and set subtraction
|
|
|
|
| |
for use when debugging
|
|
|
|
|
| |
This element is restricted to either 0 or 1. The comments detail
how its use enables an inversion list to be efficiently inverted.
|
| |
|
| |
|
|
|
|
| |
This is so functions that operate on the same data are adjacent
|
|
|
|
|
| |
Future changes will make the length no longer the same as SvCUR,
so create an element to hold the correct length
|
|
|
|
| |
This changes to use the iterator when traversing an inversion list.
|
| |
|
|
|
|
|
|
| |
An inversion list is an array of UVs. This allows for other UVs
to be added at the beginning for ancillary purposes. This patch
does not allocate any space for these, however.
|
| |
|
|
|
|
| |
This is in preparation for making things more complex in a later commit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This hasn't been used since 626725768b7b17463e9ec7b92e2da37105036252
Author: Nicholas Clark <nick@ccl4.org>
Date: Thu May 26 22:29:40 2011 -0600
regcomp.c: Fix memory leak regression
here was a remaining memory leak in the new inversion lists data
structure under threading. This solves it by changing the
implementation to use a SVpPV instead of doing our own memory
management. Then the already existing code for handling SVs
returns the memory when done.
|
|
|
|
|
|
| |
The invlist_destroy function was misleading, as it has changed to
just decrement the reference count, which may or may not lead to
immediate destruction
|
|
|
|
| |
This is in preparation to removing the function
|
|
|
|
|
|
| |
regcomp.c has a subsection dealing with the implementation of the
inversion list class(-like object). Undef its macros so they
can't possibly interfere with the rest of regcomp.c
|
|
|
|
| |
A previous commit changed things so that this is no longer necessary
|
|
|
|
|
|
|
| |
These are static functions so no external effect. Revise the calling
sequence of two functions so that they can know enough to free
memory if appropriate of the other parameters. This hides from the
callers the need for tracking when to free memory.
|
|
|
|
| |
It is not an inversion list, contrary to what this line used to say.
|
|
|
|
|
|
| |
The inversion list is an opaque object, currently implemented as an SV.
Even if it ends up being an HV in the future, Nicholas is of the opinion
that it should be presented to the world as an SV*.
|
| |
|
|
|
|
|
|
|
|
| |
There was a remaining memory leak in the new inversion lists data
structure under threading. This solves it by changing the
implementation to use a SVpPV instead of doing our own memory
management. Then the already existing code for handling SVs
returns the memory when done.
|
| |
|
|
|
|
| |
The reference count should be decremented upon freeing.
|
|
|
|
|
|
|
|
|
| |
This code was derived from published code, which says use at your
own risk. And in fact had bugs. I don't believe these show up in
5.14, as I think you have to have a list that has been inverted for this
to happen.
The comments describe what should have been done.
|
|
|
|
|
| |
Adding this macro which is the complement of an existing macro helps
understanding what is happening at its point of use
|