Announcement Announcement Module
No announcement yet.
Memory leak using RMI Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Memory leak using RMI

    I'm using the springframework for a server application that communicates with swing clients through RMI with the classes RMIServiceExporter on the server and the RmiProxyFactoryBean on the client side.

    I'm also using quartz and hibernate. The versions are:
    - 1.1.1 of Spring
    - 1.4.2 of quartz
    - 2.1.6 of Hibernate
    - And the JVM 1.4.2_06

    I've detected in this situation how the memory is increasing and with a MemoryDebugger utility I saw that some objects are never GCed. These objects are from the sun.reflect package and nobody references them:

    I've isolated the problem and when I don't publish the objects (ie. I donīt load the beans of RmiServiceExporter) the memory doesn't increase.
    If I start the server, publishing the objects, without clients the memory also increases.

    I've also tried to export all objects throgh a single class and the memory doesn't increase, but when I connect the clients I have the same problem.

    Any idea? Has anybody had this problem before?
    It's a good idea doing this connecion with another tecnology?


  • #2
    As a workaround, you could use HttpInvokers or one of the other two remoeting technologies available (aside JaxRPc): Hessian or Burlap. The latter two are quite fast, they use a very thin serialization protocol (read the reference manual part on remoting, there are some guidelines to help you choose). I am running applications in production already for quite some time using all three of the technologies and so far, it's worked quite well!

    About the problem itself, could you try to publish the objects yourself and link them in using the Spring ProxyFactoryBean approach. You might want to have a look if the memory increase happens then as well... If not, than this is a Spring issue I guess...

    Exporting the objects yourself is nothing more than:

    reg = LocateRegistry.getRegistry(portNo);
    UnicastRemoteObject.exportObject(yourService, servicePort);
    reg.rebind(name, yourService);
    Spring creates RmiInvocationWrappers to mimick the service implement Remote, so for this to work you'd have to have your interface extend Remote...



    • #3
      Any feedback ? Have you resolved the problem ?


      • #4
        Not yet

        I've made antoher solution to solve my problem.

        But the problem with RMI was not solved yet The memory increases and also the number of threads but this only hapens in some situations that i don't know.


        • #5
          what solution did you choose?

          I also have the same setup, and i see memory increase over time. after some time the client machine slows down everything. restarting the swing app restores speed.