[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
CAPE-OPEN • View topic - Call to release and primary object destructor

Call to release and primary object destructor

Discusses CAPE-OPEN specific middleware and corresponding development kit

Moderator: jasper

Call to release and primary object destructor

Postby ahmedsabriz » 02 July 2021, 12:05

ahmedsabriz
 
Posts: 20
Joined: 07 June 2021, 13:54

Re: Call to release and primary object destructor

Postby jasper » 03 July 2021, 10:28

In a typical implementation, such objects are assigned to smart pointers, which will take care of the deletion.

So in your example the parameter collection contains a smart pointer to the parameter. So when the parameter collection ends to exists, the destructor of the smart pointer invokes delete on the parameter. The unit operaton in turn has a smart pointer that contains the reference to the parameter collection. So when the unit operation gets released by the PME it deletes itself, and with that the smart pointer gets destructed and deletes the parameter collection.

Same for the ports and the port collection: the ports are referenced by smart pointers in the port collection (and perhaps also by smart pointers in the unit operation), and the port collection is referenced by the smart pointer in the unit operation.

If you set a break point on the destructor of the parameter, parameter collection, port or port collection, you see the call stack when this happens.
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain


Return to CAPE-OPEN Binary Interop Architecture

Who is online

Users browsing this forum: No registered users and 2 guests

cron