Spring Boot version 2.4.6

I have recently been researching a potential memory leak in our REST service. I believe I have narrowed it down to class MetricsClientHttpRequestInterceptor. Specifically it contain a static list named urlTemplate. I believe this list is growing without constraint and I have to question some code on lines 97-99 that follow:

if (urlTemplate.get().isEmpty()) {
urlTemplate.remove();           
}

Do we potentially need a NOT operator here so that items are removed from the list ? Thank you for your consideration.

heapdump

Comment From: wilkinsona

Duplicates #25860.