a question about memory

in Help Center
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.
{
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.
0
Comments
Regards, Matthew
continuously ,but the creation is not successful every time , memory group continuously.my purpose is to connect the server realtime.
Matthew
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.
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.
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.
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