Possible Memory leak in Number of Loaded classes in Java Application

前端 未结 6 522
被撕碎了的回忆
被撕碎了的回忆 2021-02-02 02:29

I recently began profiling an osgi java application that I am writing using VisualVM. One thing I have noticed is that when the application starts sending data to a client (ove

6条回答
  •  执念已碎
    2021-02-02 03:15

    Are you dynamically creating new classes on the fly somehow?

    Thanks for your help. I figured out what the problem is. In one of my classes, I was using Jaxb to create an XML string. In doing this, JAXB ueses reflection to create a new class.

    JAXBContext context = JAXBContext.newInstance(this.getClass());
    

    So although the JAXBContext wasn't saying around in the heap, the classes had been loaded.

    I have run my program again, and I see a normal plateau as I would expect.

提交回复
热议问题