martint / jmxutils

Exporting JMX mbeans made easy
Apache License 2.0
171 stars 47 forks source link

Cache reusable reflection computations #59

Open oskar-szwajkowski opened 2 weeks ago

oskar-szwajkowski commented 2 weeks ago

Utilize static caches for reflection computations that are specific to classes, which do not change between classloaders

This should improve CPU and memory usage of applications that repeatedly use MBeanBuilders, and should have tiny memory footprint for caches itself

oskar-szwajkowski commented 1 day ago

This can result in memory leaks in the case of objects being exported dynamically (via MBeanExporter), as the caches will never be cleaned up and the classes referenced by the caches will never be garbage collected.

Then I don't see a way of creating such cache without introducing 'small' memory leak, that would have positive impact on CPU time / memory needed to go over those JMX annotated classes

other options could be:

thoughts?