/* hv.c */ #define HV_MAX_LENGTH_BEFORE_SPLIT 14 ... Perl_hv_common( ... ) { ... while ((counter = HeNEXT(counter))) n_links++; if (n_links > HV_MAX_LENGTH_BEFORE_SPLIT) { /* Use only the old HvKEYS(hv) > HvMAX(hv) condition to limit bucket splits on a rehashed hash, as we're not going to split it again, and if someone is lucky (evil) enough to get all the keys in one list they could exhaust our memory as we repeatedly double the number of buckets on every entry. Linear search feels a less worse thing to do. */ hsplit(hv); } ... }