Henrik Grubbstr?m (Lysator) @ Pike (-) developers forum wrote:
Two things: a. I see a remark about making that cache-mapping weak. What would that help (it contains strings only)?
If the mapping were to be weak, any strings only referenced from the mapping would be freed whenever the mapping hashtable needs to grow.
Ok, tested it, and can confirm that it works. Shouldn't this be documented somewhere?
Anyway, in this case, I decided that it might not be what we want. Typically you either connect to a lot of places, but do not reconnect a lot. Or you reconnect to a few places a lot. So having a hard maximum on the cached numbers is fine. If we'd make it weak, and skip the sizecheck, it would grow in exponential steps, which is undesirable for long running servers that connect a lot.