Add ref counting for mapper if it is needed to share a same mapper
between several containers.