View Single Post
  #1 (permalink)  
Old 10-01-2004
Baloo Baloo is offline
Registered User
 
 
Join Date: Sep 2004
Location: Hungary (one joke and you're dead)
Posts: 5
question about memory mgmt

Hi!


Are all Ice objects managed? I mean, assuming that I call Ice::Initialize at the beginning of main(), and destroy at the end, all Ice data should be deleted properly upon exiting, shouldn't they? I ask because the VS.NET 2003 shows some memory leaks, however my reference counters indicate the the classes I wrote were cleaned up nicely.

The object dump is the following:

Detected memory leaks!
{518} normal block at 0x003ADCB0, 32 bytes long.
Data: <Ice.Trace.Protoc> 49 63 65 2E 54 72 61 63 65 2E 50 72 6F 74 6F 63
{517} normal block at 0x003ADC28, 72 bytes long.
Data: <@ : : p : > 40 DB 3A 00 08 C0 3A 00 70 D9 3A 00 CD CD CD CD
{506} normal block at 0x003ADBC8, 32 bytes long.
Data: <Ice.Trace.Networ> 49 63 65 2E 54 72 61 63 65 2E 4E 65 74 77 6F 72
{505} normal block at 0x003ADB40, 72 bytes long.
Data: < : ( : : > B8 BE 3A 00 28 DC 3A 00 B8 BE 3A 00 CD CD CD CD
{490} normal block at 0x003ADAE0, 32 bytes long.
Data: <Ice.ConnectionId> 49 63 65 2E 43 6F 6E 6E 65 63 74 69 6F 6E 49 64
{489} normal block at 0x003ADA58, 72 bytes long.
Data: < : : : > B8 BE 3A 00 08 C0 3A 00 B8 BE 3A 00 CD CD CD CD
{481} normal block at 0x003AD9F8, 32 bytes long.
Data: <Ice.Warn.Connect> 49 63 65 2E 57 61 72 6E 2E 43 6F 6E 6E 65 63 74
{480} normal block at 0x003AD970, 72 bytes long.
Data: < : ( : : > B8 BE 3A 00 28 DC 3A 00 B8 BE 3A 00 CD CD CD CD
{470} normal block at 0x003AD910, 32 bytes long.
Data: <DRobot.Endpoints> 44 52 6F 62 6F 74 2E 45 6E 64 70 6F 69 6E 74 73
{469} normal block at 0x003AD888, 72 bytes long.
Data: < : : : > B8 BE 3A 00 A0 D3 3A 00 B8 BE 3A 00 CD CD CD CD
{464} normal block at 0x003AD428, 32 bytes long.
Data: <DRobot:tcp -p 10> 44 52 6F 62 6F 74 3A 74 63 70 20 2D 70 20 31 30
{463} normal block at 0x003AD7A0, 72 bytes long.
Data: < : : : > A0 D3 3A 00 B8 BE 3A 00 08 C0 3A 00 CD CD CD CD
{458} normal block at 0x003AD740, 32 bytes long.
Data: <DEnvironment.End> 44 45 6E 76 69 72 6F 6E 6D 65 6E 74 2E 45 6E 64
{457} normal block at 0x003AD6B8, 72 bytes long.
Data: < : : : > B8 BE 3A 00 D0 D5 3A 00 B8 BE 3A 00 CD CD CD CD
{452} normal block at 0x003AD340, 32 bytes long.
Data: <DEnvironment:tcp> 44 45 6E 76 69 72 6F 6E 6D 65 6E 74 3A 74 63 70
{451} normal block at 0x003AD658, 32 bytes long.
Data: <DEnvironment.Pro> 44 45 6E 76 69 72 6F 6E 6D 65 6E 74 2E 50 72 6F
{450} normal block at 0x003AD5D0, 72 bytes long.
Data: < : : : > B8 D6 3A 00 A0 D3 3A 00 88 D4 3A 00 CD CD CD CD
{443} normal block at 0x003AD510, 32 bytes long.
Data: <DManager.Endpoin> 44 4D 61 6E 61 67 65 72 2E 45 6E 64 70 6F 69 6E
{442} normal block at 0x003AD488, 72 bytes long.
Data: < : : : > B8 BE 3A 00 D0 D5 3A 00 B8 BE 3A 00 CD CD CD CD
{437} normal block at 0x003AD2E0, 32 bytes long.
Data: <DManager:tcp -p > 44 4D 61 6E 61 67 65 72 3A 74 63 70 20 2D 70 20
{436} normal block at 0x003AD3A0, 72 bytes long.
Data: < : : : > D0 D5 3A 00 A0 D7 3A 00 88 D8 3A 00 CD CD CD CD
{369} normal block at 0x003AC090, 96 bytes long.
Data: <c:\Documents and> 63 3A 5C 44 6F 63 75 6D 65 6E 74 73 20 61 6E 64
{368} normal block at 0x003AC008, 72 bytes long.
Data: <X : : ( : > 58 DA 3A 00 A0 D7 3A 00 28 DC 3A 00 CD CD CD CD
{367} normal block at 0x003ABEB8, 72 bytes long.
Data: < : : p : > B8 D6 3A 00 A0 D7 3A 00 70 D9 3A 00 CD CD CD CD
{366} normal block at 0x003A4B00, 64 bytes long.
Data: <x3\ 3\ > 78 33 5C 00 AC 33 5C 00 D8 A9 14 00 FF FF FF FF
Object dump complete.

The initialization code is the following:

Code:
	Ice::PropertiesPtr properties = Ice::createProperties(argc, argv);
	properties->load("pathfinder.cfg");
	IObject::ic = Ice::initializeWithProperties(argc, argv, properties);
NetManager:

Code:
		Ice::ObjectAdapterPtr adapter = 
			IObject::ic->createObjectAdapterWithEndpoints("DManagerAdapter", ""); 

		adapter->add(this, Ice::stringToIdentity("DManager")); 
		adapter->activate();
... and NetEnvironment:

Code:
		Ice::ObjectAdapterPtr adapter = 
			IObject::ic->createObjectAdapterWithEndpoints("DEnvironmentAdapter", ""); 

		adapter->add(this, Ice::stringToIdentity("DEnvironment")); 
		adapter->activate();
The upper two sections are called in the constructors of two different classes. The adapters are stored as private members. Apart from calling waitforShutdown, the upper code is pretty much the same as that of the demos...
After finishing the constructors, the program basically just waits for an ESC and then cleans up:

Code:
		delete server;
		IObject::ic->destroy();
		IDummy* tmp = new IDummy();
		delete tmp;
		exit(0);
The server class holds a NetEnvironment and a NetManager instance. The IDummy does nothing but prints the reference counters into a logfile.

Any ideas?

Thanks in advance,

Baloo
Reply With Quote