Method Regexp.PCRE2.MatchContext()->set_depth_limit()

class Regexp.PCRE2.MatchContext

Method set_depth_limit

void set_depth_limit(int value)

Description

Limit the depth of nested backtracking in pcre2_match(). Each time a nested backtracking point is passed, a new memory frame is used to remember the state of matching at that point. Thus, this parameter indirectly limits the amount of memory that is used in a match. However, because the size of each memory frame depends on the number of capturing parentheses, the actual memory limit varies from pattern to pattern. This limit was more useful in versions before 10.30, where function recursion was used for backtracking.