Home Help Center

A question for Michi regarding his IEEE article

albertodsalbertods Member Alberto Della SantinaOrganization: University of Pisa - department of IT EngineeringProject: Mobile remote controller ✭✭
Dear Michi,
first of all I would like to give my compliments for your article! This is a fantastic introduction to the so many advantages offered to the programmer by the ICE technology.
In order to understand this technology for my thesis more in detail I appreciated a lot this paper.

I have a little question to ask you:
why you define "leak" these rows of Corba C++ ?

cout << ref—>getString();
r1—>putString(r2—>getString());
std::string s(ref—>getString());



Thanks in advance


With my very best regards


Alberto

Comments

  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    albertods wrote: »
    why you define "leak" these rows of Corba C++ ?

    cout << ref—>getString();
    r1—>putString(r2—>getString());
    std::string s(ref—>getString());

    getString() returns a char *. The memory for that string is allocated by the callee, that is by getString(), and the caller is expected to deallocate the memory again. Failure to do so causes a memory leak.

    The above examples all use the return value from getString() but neglect to assign the return value to a variable, with the result that the return value cannot be deallocated, so the application suffers a memory leak. I chose these examples to illustrate how easy it is to innocently make this mistake.

    Cheers,

    Michi.
  • albertodsalbertods Member Alberto Della SantinaOrganization: University of Pisa - department of IT EngineeringProject: Mobile remote controller ✭✭
    Thank you very much! That has been very kind of you!


    Best wishes


    Alberto
Sign In or Register to comment.