summaryrefslogtreecommitdiffstats
path: root/generic/regguts.h
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2015-10-20 19:53:03 (GMT)
committerdgp <dgp@users.sourceforge.net>2015-10-20 19:53:03 (GMT)
commit75ed02d88822dad90ad256551f2df875aa884975 (patch)
treeab8cd7941695f1a4b7ec8f58c5e5defc75cbcc84 /generic/regguts.h
parent5ec3b6491d71b85b55f8927e78f033e75c92170f (diff)
downloadtcl-75ed02d88822dad90ad256551f2df875aa884975.zip
tcl-75ed02d88822dad90ad256551f2df875aa884975.tar.gz
tcl-75ed02d88822dad90ad256551f2df875aa884975.tar.bz2
Adaptation of re-memaccounting.patch from Tom Lane @postgres.
Diffstat (limited to 'generic/regguts.h')
-rw-r--r--generic/regguts.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/generic/regguts.h b/generic/regguts.h
index 7ed8ec1..72bdcb3 100644
--- a/generic/regguts.h
+++ b/generic/regguts.h
@@ -307,9 +307,6 @@ struct nfa {
struct colormap *cm; /* the color map */
color bos[2]; /* colors, if any, assigned to BOS and BOL */
color eos[2]; /* colors, if any, assigned to EOS and EOL */
- size_t size; /* Current NFA size; differs from nstates as
- * it also counts the number of states created
- * by children of this state. */
struct vars *v; /* simplifies compile error reporting */
struct nfa *parent; /* parent NFA, if any */
};
@@ -339,11 +336,16 @@ struct cnfa {
#define NULLCNFA(cnfa) ((cnfa).nstates == 0)
/*
- * Used to limit the maximum NFA size to something sane. [Bug 1810264]
+ * This symbol limits the transient heap space used by the regex compiler,
+ * and thereby also the maximum complexity of NFAs that we'll deal with.
+ * Currently we only count NFA states and arcs against this; the other
+ * transient data is generally not large enough to notice compared to those.
+ * Note that we do not charge anything for the final output data structures
+ * (the compacted NFA and the colormap).
*/
-
-#ifndef REG_MAX_STATES
-# define REG_MAX_STATES 100000
+#ifndef REG_MAX_COMPILE_SPACE
+#define REG_MAX_COMPILE_SPACE \
+ (100000 * sizeof(struct state) + 100000 * sizeof(struct arcbatch))
#endif
/*