eclipse-serializer / serializer

Serializer project
Eclipse Public License 2.0
64 stars 6 forks source link

LazyReferenceManager keeps producing garbage for logging #132

Closed Bios-Marcel closed 2 months ago

Bios-Marcel commented 2 months ago

Hey,

I have noticed, that once the LazyReferenceManager starts working, it keeps calling beginCycle and endCycle.

These two call .trace with a method reference that prints statistics. These LazyArg instances keep polluting memory, which is quite unnecessary, as they could be private final.

https://github.com/eclipse-serializer/serializer/blob/9f1a2ab72754f5c6abeafd2419330f3f521d6d7f/base/src/main/java/org/eclipse/serializer/reference/Lazy.java#L856C1-L883C5

This is what it looks like in VisualVM, it goes up and down like 170MB every 5 seconds or so. I am using the default configuration for LazyReferenceManager.

image