Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 12-26-2006
albertods albertods is offline
Registered User
 
Name: Alberto Della Santina
Organization: University of Pisa - department of IT Engineering
Project: Mobile remote controller
 
Join Date: Feb 2006
Location: Pisa (Italy)
Posts: 58
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
__________________
Alberto Della Santina
IT Engineering Department
University of Pisa (Italy)
www.ing.unipi.it
www.iet.unipi.it
Reply With Quote
  #2 (permalink)  
Old 12-26-2006
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 931
Quote:
Originally Posted by albertods View Post
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.
Reply With Quote
  #3 (permalink)  
Old 12-26-2006
albertods albertods is offline
Registered User
 
Name: Alberto Della Santina
Organization: University of Pisa - department of IT Engineering
Project: Mobile remote controller
 
Join Date: Feb 2006
Location: Pisa (Italy)
Posts: 58
Thank you very much! That has been very kind of you!


Best wishes


Alberto
__________________
Alberto Della Santina
IT Engineering Department
University of Pisa (Italy)
www.ing.unipi.it
www.iet.unipi.it
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
New article by ZeroC's Chief Scientist marc Announcements 0 06-07-2006 02:45 PM
latest patch by michi xdm Help Center 5 01-23-2006 02:26 PM
Feedback on an article about multithreaded design of a game engine lstep Comments 3 12-02-2005 10:49 AM
Article about online games and Ice michi Announcements 0 01-17-2004 06:57 PM
New Article about Ice marc Announcements 0 01-07-2004 09:17 PM


All times are GMT -4. The time now is 12:40 AM.


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