Document race issue for pcre2_code_free() after serialize/deserialize.
This commit is contained in:
parent
2caf22dc61
commit
3e24a1b351
|
@ -1,4 +1,4 @@
|
||||||
.TH PCRE2SERIALIZE 3 "20 January 2015" "PCRE2 10.10"
|
.TH PCRE2SERIALIZE 3 "03 November 2015" "PCRE2 10.21"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
PCRE2 - Perl-compatible regular expressions (revised API)
|
PCRE2 - Perl-compatible regular expressions (revised API)
|
||||||
.SH "SAVING AND RE-USING PRECOMPILED PCRE2 PATTERNS"
|
.SH "SAVING AND RE-USING PRECOMPILED PCRE2 PATTERNS"
|
||||||
|
@ -22,12 +22,12 @@ If you are running an application that uses a large number of regular
|
||||||
expression patterns, it may be useful to store them in a precompiled form
|
expression patterns, it may be useful to store them in a precompiled form
|
||||||
instead of having to compile them every time the application is run. However,
|
instead of having to compile them every time the application is run. However,
|
||||||
if you are using the just-in-time optimization feature, it is not possible to
|
if you are using the just-in-time optimization feature, it is not possible to
|
||||||
save and reload the JIT data, because it is position-dependent. In addition,
|
save and reload the JIT data, because it is position-dependent. The host on
|
||||||
the host on which the patterns are reloaded must be running the same version of
|
which the patterns are reloaded must be running the same version of PCRE2, with
|
||||||
PCRE2, with the same code unit width, and must also have the same endianness,
|
the same code unit width, and must also have the same endianness, pointer width
|
||||||
pointer width and PCRE2_SIZE type. For example, patterns compiled on a 32-bit
|
and PCRE2_SIZE type. For example, patterns compiled on a 32-bit system using
|
||||||
system using PCRE2's 16-bit library cannot be reloaded on a 64-bit system, nor
|
PCRE2's 16-bit library cannot be reloaded on a 64-bit system, nor can they be
|
||||||
can they be reloaded using the 8-bit library.
|
reloaded using the 8-bit library.
|
||||||
.
|
.
|
||||||
.
|
.
|
||||||
.SH "SAVING COMPILED PATTERNS"
|
.SH "SAVING COMPILED PATTERNS"
|
||||||
|
@ -139,10 +139,15 @@ PCRE2_ERROR_BADMAGIC may mean that the data is corrupt, or that it was compiled
|
||||||
on a system with different endianness.
|
on a system with different endianness.
|
||||||
.P
|
.P
|
||||||
Decoded patterns can be used for matching in the usual way, and must be freed
|
Decoded patterns can be used for matching in the usual way, and must be freed
|
||||||
by calling \fBpcre2_code_free()\fP as normal. A single copy of the character
|
by calling \fBpcre2_code_free()\fP. However, be aware that there is a potential
|
||||||
tables is used by all the decoded patterns. A reference count is used to
|
race issue if you are using multiple patterns that were decoded from a single
|
||||||
|
byte stream in a multithreaded application. A single copy of the character
|
||||||
|
tables is used by all the decoded patterns and a reference count is used to
|
||||||
arrange for its memory to be automatically freed when the last pattern is
|
arrange for its memory to be automatically freed when the last pattern is
|
||||||
freed.
|
freed, but there is no locking on this reference count. Therefore, if you want
|
||||||
|
to call \fBpcre2_code_free()\fP for these patterns in different threads, you
|
||||||
|
must arrange your own locking, and ensure that \fBpcre2_code_free()\fP cannot
|
||||||
|
be called by two threads at the same time.
|
||||||
.P
|
.P
|
||||||
If a pattern was processed by \fBpcre2_jit_compile()\fP before being
|
If a pattern was processed by \fBpcre2_jit_compile()\fP before being
|
||||||
serialized, the JIT data is discarded and so is no longer available after a
|
serialized, the JIT data is discarded and so is no longer available after a
|
||||||
|
@ -165,6 +170,6 @@ Cambridge, England.
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
Last updated: 20 January 2015
|
Last updated: 03 November 2015
|
||||||
Copyright (c) 1997-2015 University of Cambridge.
|
Copyright (c) 1997-2015 University of Cambridge.
|
||||||
.fi
|
.fi
|
||||||
|
|
Loading…
Reference in New Issue