Count references to prevent leakage from dependency cycles.