|
|
|
|||||
|
a question about memory
for(int i=0;i<100;i++)
{ try { o_icecomm = Ice.Util.initialize(ref arg); Ice.ObjectPrx obj = o_icecomm.stringToProxy("PCManager:default -h 172.16.166.6 -p 10000"); PCManagerPrx PCmanager= PCManagerPrxHelper.checkedCast(obj); .......... } catch { } } when the program is executed, throw exceptions.because I did not start service of ICE. I find that memoy of thread grow fastly.why? thank you. |
|
|||||
|
for example: I Input a IP of server,but if the server is not open ,connection will not be created. PCManager will be created
continuously ,but the creation is not successful every time , memory group continuously.my purpose is to connect the server realtime. |
|
||||||
|
You only need to create the communicator once, not over & over again. The problem in your application most likely is that you do not call destroy() on the communicator, so the resources are never released.
Matthew |
|
|||||
|
I call destroy() ;
for(int i=0;i<100;i++) { try { o_icecomm = Ice.Util.initialize(ref arg); Ice.ObjectPrx obj = o_icecomm.stringToProxy("PCManager:default -h 172.16.166.6 -p 10000"); PCManagerPrx PCmanager= PCManagerPrxHelper.checkedCast(obj); .......... } catch { o_icecomm = Ice.Util.initialize(ref arg);///////////////////////////////// Ice.ObjectPrx obj = o_icecomm.stringToProxy("PCManager:default -h 172.16.166.6 -p 10000"); PCManagerPrx PCmanager= PCManagerPrxHelper.uncheckedCast(obj); o_icecomm.destroy(); } } but,the resources are not released. |
|
||||||
|
I don't see destroy being called for the communicator in the try-block. You apparently create a new communicator in the catch-block (why?), which then gets destroyed, but only if the catch-block itself doesn't raise an exception.
Please have a look at one of the Ice demos and the Ice manual for more information on how to properly initialize and shut down communicators. |
|
|||||
|
Because I only destroy the communicator that was not connect.
If it throws exception in "PCManagerPrx PCmanager= PCManagerPrxHelper.checkedCast(obj);" . I only want to destroy the communicator in "Ice.ObjectPrx obj = o_icecomm.stringToProxy("PCManager:default -h 172.16.166.6 -p 10000");". If it does'n throws exception,I shall create communicator and connect. So I destroy communicator in Catch-block. |
|
||||||
|
I don't understand what you are trying to say. But the sample code you pasted is not correct. It should read something like:
o_icecomm = Ice.Util.initialize(ref arg); for(int i=0;i<100;i++) { try { Ice.ObjectPrx obj = o_icecomm.stringToProxy("PCManager:default -h 172.16.166.6 -p 10000"); PCManagerPrx PCmanager= PCManagerPrxHelper.checkedCast(obj); .......... } catch { Ice.ObjectPrx obj = o_icecomm.stringToProxy("PCManager:default -h 172.16.166.6 -p 10000"); PCManagerPrx PCmanager= PCManagerPrxHelper.uncheckedCast(obj); } } o_icecomm.destroy(); You should not create the communicator over and over again. Matthew |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A question about memory limit in Ice. | ehero | Help Center | 3 | 06-28-2005 11:35 AM |
| A question about decrease memory | laotee | Help Center | 5 | 06-27-2005 06:25 AM |
| Mismatched memory question | stephan | Help Center | 6 | 03-28-2005 09:14 PM |
| question about memory mgmt | Baloo | Help Center | 2 | 10-01-2004 07:02 PM |
| In-memory IceStorm | vukicevic | Patches | 2 | 01-20-2004 08:56 PM |