Home Help Center

Does it mean that there are memory leak problems in my program?

yrh79yrh79 Member
Hi all,
I tested the example program of "Hello World Application", with a little modification, where I implemented the logic in a mfc program, and i noticed that my program eats up more and more memory with time going.
My implement looks like this:
// CMainFrame construction/destruction
CMainFrame::CMainFrame() : m_trayIcon(IDR_TRAYICON)
	// TODO: add member initialization code here
	m_bShutdown = FALSE;

	int noUse = 0;
	try {
		ic = Ice::initialize(noUse, NULL);
		Ice::ObjectAdapterPtr adapter
			= ic->createObjectAdapterWithEndpoints(
			"SimplePrinterAdapter", "default -p 10000");
		object = new PrinterI(this);
	} catch (const Ice::Exception & ex) {
		string s = "error: " + ex.ice_name();
	} catch (const char * msg) {


//PrinterI implementation:
PrinterI::PrinterI(CMainFrame *pOwner)
	myOwner = pOwner;

void PrinterI::printString(const string & s, const Ice::Current &)
	myOwner->setMsgToDisplay("Incoming Message",s);

My test is a little different from the "Hellow World Application", i commented out the next line:
I don't know what's the purpose of this line, and it just hang my program there.
My test code is in the Attachment, could anyone please help me for this?


  • yrh79yrh79 Member
    more I've found out

    I see this memory leak problem seams obvious when the program runs in Windows 2003, but it seams no problem in Windows 2000.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    I can't see anything wrong with the Ice related code. It's fine to comment out the call to waitForShutdown, this call is only used to block the main thread until the communicator is shutdown. I would recommend to use a tool to detect memory leaks such as Purify to try to find out where the memory consumption is coming from. I doubt it's coming from Ice but if you still suspect a problem with your Ice code, please provide more information on your platform, Ice version and reasons why you think it might be coming from Ice... and we'll have a closer look :).

  • yrh79yrh79 Member
    Thank you very much

    Hi benoit,
    Thank you very much for your advice! I will look closer into the program. What I've seen now, is my program released most of the memory it have eaten after a very looong time it runs with no actions(as far as what i can see).
    Those memory it used might due to other factors of the program. ;)

    So why i thought it were related to ICE? Because Visual Studio told me that there are memory leak problems in the program just after I added ICE surpport to the test, so I took for granted that the memory problems were related to ICE. I was proved wrong. :o
Sign In or Register to comment.