Refine allocations for improved memory profile when creating a large amount of proxy instances #30499
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
JdkDynamicAopProxy
allocates a lot of objects infindDefinedEqualsAndHashCodeMethods
and in the constructor viaAopProxyUtils.completeProxiedInterfaces
(object arrays, collection instances) to compute whether the interfaces implement hashCode/equals methods.This effect gets visible when creating several thousand (100000s) proxy instances. It would be neat to either have a built-in cache for these values or to be able to override these features so Spring Data could supply values from its caches.
Recorded allocations:
Right now, this isn't possible because the methods are
private
or being called within the constructor. Also, the implementation ofinvoke
uses several package-private fields ofProxyConfig
and other protected components.We found this aspect while debugging a more significant memory issue via spring-projects/spring-data-commons#2831
The text was updated successfully, but these errors were encountered: