Archived

This forum has been archived. Please start a new discussion on GitHub.

Memory leak during ice initialisation

Hello,

I am writing a browser application (Visual Studio XBAP) that uses ICE to connect to a server and retrieve data.
When refreshing the browser my browser application is terminated and restarted again. In this case however there is some memory leak.
I have written a small WinForms test application that has the same behaviour regarding ICE. This application has three buttons:
1. Initialise: This initialises ICE.
2. Read value: This reads a value from the server. In this case the name of the server.
3. Terminate: This terminates ICE, sets the neccesary references to null and performs a GarbageCollect.

When running this application and checking using Perfmon (the private bytes of the application) a memory leak occurs as well.
The scenario that I perform is:
1. Press Initialise once.
2. Press ReadValue once.
3. Press Terminate once.

After each Initialise the number of private bytes increases After each Terminate the number of private bytes does not decrease. Since my XBAP application will be refreshed a lot this is a serious showstopper for me. After refreshing the XBAP application for about 150 times the application generates and out of memory exception (on a machine with 1GB).

A zip file containing the project (build using VS2008Express and ICE 3.3.1) is attached.

What must I do to make sure that the number of private bytes does not increase?


Best regards,

Joost van Doorn

Comments

  • Status?

    Hello,

    I am used to very fast reactions one questions asked in the forums of zeroc. In most cases it is a matter of hours. However this question has not been answered yet. Is that because it is not considered to be an issues or is it difficult to reproduce, or.... So could you please let me know whether or not you wnat to investigate this and what the current status is.

    Thanks,

    Joost
  • benoit
    benoit Rennes, France
    Hi,

    Sorry, we simply didn't get a chance to look into it yet, looking into a test case always takes a bit more time than answering a simple question :). If you need guaranteed response time, you should consider purchasing some commercial support from us, send us an email at info@zeroc.com if you want to know more about this.

    Anyway, I tried your test case but the client wasn't able to connect to the server and no server is provided. However, after looking at the code of the client, I think the problem comes from the fact that you don't destroy the communicator.

    Instead of the following busy loop:
    while(mIce.isShutdown())
    {
         mIce.shutdown();
    }
    
    You should instead simply call:
    mIce.destroy();
    

    This will shutdown the Ice server runtime and wait for its shutdown to complete (equivalent to your busy loop or same as calling shutdown and then waitForShutdown on the communicator) and this will also destroy the Ice client side runtime. If you don't call destroy on the communicator, the Ice communicator can't be garbage collected.

    Hopefully this will solve your issue and let us know if it doesn't!

    Cheers,
    Benoit.
  • I have performed the change and tested it for one night. The results are ok, no more memory leaks. Thank you for the solution.

    Joost van Doorn