The method org.apache.logging.log4j.core.util.WatchManager.getWatchers() should pre-allocate its the new Map it creates to the specific size it knows will be used.