Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 06-27-2005
laotee laotee is offline
Registered User
 
 
Join Date: Jun 2005
Posts: 41
A question about decrease memory

My program includes many ICE client.
I find when I execute this code to create ICE client:

o_icecomm = Ice.Util.initialize(ref arg);
Ice.ObjectPrx obj = o_icecomm.stringToProxy(sConnectstr);
PCManagerPrx PCmanager= PCManagerPrxHelper.checkedCast(obj);//end

,The memoy increase. As the Clients of ICE increase ,the memory of the program increase. I think if I create 200 clients of ICE in the program ,the memory is about 400M. So .my computer is very "slow"! In the case, how can I decrease the memory?

thanks!
Reply With Quote
  #2 (permalink)  
Old 06-27-2005
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
It looks like your code creates many communicators. A communicator is not a light weight object: you should share a single communicator object instead of creating 200 of them. Or is there any specific reasons for creating so many communicator objects?

To release the memory allocated by a communicator object, you need to destroy the communicator:

Code:
  o_icecomm.destroy();
Hope this helps.

Benoit.
Reply With Quote
  #3 (permalink)  
Old 06-27-2005
laotee laotee is offline
Registered User
 
 
Join Date: Jun 2005
Posts: 41
I don't understand how do I share a single communicator object instead of creating 200 of them. I need many conncetors when my parogram has been executed,not one connector. So my communicators will be destroy only that the program is closed.or the server program is closed.
Reply With Quote
  #4 (permalink)  
Old 06-27-2005
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
Perhaps I misunderstood your original post but I was under the impression that you were creating 200 communicators within the same process, in which case you could simply use a single shared communicator instead (even if you're connecting to multiple servers...).

Is your application actually creating 200 processes, each process being an Ice client connecting an Ice server? I'm not sure what is your concern with respect to memory in this case... Can you detail a little more your application so that we can better help you?

Benoit.
Reply With Quote
  #5 (permalink)  
Old 06-27-2005
laotee laotee is offline
Registered User
 
 
Join Date: Jun 2005
Posts: 41
Code:
public  void createICEagent()
{
string ConnectIP=string.empty;
  IList lstIp=new ArrayList();
  Ice.Communicator o_icecomm = null;
  o_icecomm = Ice.Util.initialize(ref arg);
  lstIp.Add("172.16.16.16");
  lstIp.Add("172.16.16.12");
  lstIp.Add("172.16.16.13");
  lstIp.Add("172.16.16.15");
for(int i=0;i<lstIp.Count;i++)
{ 
   try
   {
     ConnectIP=lstIp[i];
     Ice.ObjectPrx obj = o_icecomm.stringToProxy(ConnectIP);
      PCManagerPrx PCmanager= PCManagerPrxHelper.checkedCast(obj);
   }
  catch
  {

  }

}
when I executed this code ,the memory increase 4 times.because I create 4 clients.
Reply With Quote
  #6 (permalink)  
Old 06-27-2005
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
I suppose that by Ice "client" you actually mean Ice "proxy". I don't see why creating a proxy and doing a checkedCast on this proxy would consume a lot of memory -- it shouldn't.

The best way to investigate this problem would be to send us a small self-compilable example demonstrating it, please also specify which OS and Ice version you are using.

Btw, I'm not sure if is intended or not, but "172.16.16.15" is a stringified proxy representing an indirect proxy containing only the object identity "172.16.16.15" (it's not interpreted as an IP address!). If your goal is to invoke on an object which is hosted by the host with the "172.16.16.15" IP address, the proxy should be something like: "myobject:tcp -h 172.16.16.15 -p 12345" where "myobject" if the identity of the object.

Benoit.

Last edited by benoit : 06-27-2005 at 08:02 AM. Reason: fixed wrong proxy
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
ice should decrease port hellocyf Comments 5 11-07-2006 05:58 AM
A question about memory limit in Ice. ehero Help Center 3 06-28-2005 11:35 AM
a question about memory laotee Help Center 8 06-22-2005 11:17 PM
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


All times are GMT -4. The time now is 08:45 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.