JinZhou Huang opened SPR-17425 and commented

In case that there is a bean named A, and it has an alias named B, and B has an alias named C, after alias B was removed through SimpleAliasRegistry#removeAlias(String), the pair B and C is still in the aliasMap of SimpleAliasRegistry. I think it should be considered as a kind of memory leak.


Affects: 5.0.9

Comment From: spring-projects-issues

Juergen Hoeller commented

Another way to see it: The C->B definition is still intact but there is no resolvable reference for B at that point. Whenever a new definition for B comes in, the C->B reference applies again. In that sense, it's a rule that keeps being registered even if it is temporarily inapplicable.

Comment From: spring-projects-issues

JinZhou Huang commented

That is exactly a way to see this, since that this case barely happens and the C->B reference could be applied again soon. I just confused when I browsing the code, because that I just have figured out double way to treat it, either remove C->B or make C -> A.

Comment From: bclozel

Closing per https://github.com/spring-projects/spring-framework/issues/21958#issuecomment-453478715