Archived
This forum has been archived. Please start a new discussion on GitHub.
A question for Michi regarding his IEEE article
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
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
0
Comments
-
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.0 -
Thank you very much! That has been very kind of you!
Best wishes
Alberto0