[cicm] Freeing Memory and Constructors

"Nanjundiah, Girish" <Girish.Nanjundiah@viasat.com> Tue, 07 June 2011 20:17 UTC

Return-Path: <girish.nanjundiah@viasat.com>
X-Original-To: cicm@ietfa.amsl.com
Delivered-To: cicm@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 850DE11E81AE for <cicm@ietfa.amsl.com>; Tue, 7 Jun 2011 13:17:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[AWL=-0.001, BAYES_00=-2.599, HTML_MESSAGE=0.001]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fuisgrF6-pgV for <cicm@ietfa.amsl.com>; Tue, 7 Jun 2011 13:17:09 -0700 (PDT)
Received: from viasat.com (bateleur.viasat.com [199.106.52.160]) by ietfa.amsl.com (Postfix) with ESMTP id 44D2011E81A8 for <cicm@ietf.org>; Tue, 7 Jun 2011 13:17:09 -0700 (PDT)
Received: from ([172.20.1.71]) by bateleur.viasat.com with ESMTP id H6GMFJ1.45665651; Tue, 07 Jun 2011 13:17:05 -0700
Received: from vcaexch06.hq.corp.viasat.com ([172.18.46.74]) by VCAEXCH02.hq.corp.viasat.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 7 Jun 2011 13:17:05 -0700
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CC254F.C89161EE"
Date: Tue, 07 Jun 2011 13:16:28 -0700
Message-ID: <E3337014FCBC034BBD725917528D5D7BD08CCA@vcaexch06.hq.corp.viasat.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: Freeing Memory and Constructors
Thread-Index: AcwlT8i+OpC2oJYrQXCIpeOOY1Vn/g==
From: "Nanjundiah, Girish" <Girish.Nanjundiah@viasat.com>
To: CICM Discussion List <cicm@ietf.org>
X-OriginalArrivalTime: 07 Jun 2011 20:17:05.0190 (UTC) FILETIME=[DE773460:01CC254F]
Subject: [cicm] Freeing Memory and Constructors
X-BeenThere: cicm@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
Reply-To: CICM Discussion List <cicm@ietf.org>
List-Id: CICM Discussion List <cicm.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cicm>, <mailto:cicm-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/cicm>
List-Post: <mailto:cicm@ietf.org>
List-Help: <mailto:cicm-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cicm>, <mailto:cicm-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 07 Jun 2011 20:17:11 -0000

Hello Everyone,

 

We have the following remaining questions about the CICM code and were
wondering if anyone had any ideas:

 

1.       Many of the functions in the CICM driver are called with a
double pointer parameter that is labeled as "out", meaning that the
parameter is expected to be pointing to a newly created instance of its
type upon the function's return (Ex: Decrypt::Stream::decrypt( Buffer**
buffer )). By allocating memory in functions like this, we introduce
memory leaks into the program since decrypt.cpp and encrypt.cpp do not
delete anything. Is this acceptable behavior or should we add member
variables with destructors into the classes to take care of cleaning up
the memory?

2.       Using _get and _set functions for accessing member variables
works but it also introduces the potential problem of depending on
uninitialized read-only member variables to set a value (Ex: We use the
read-only Key::State state variable to check if a Key::_set_identifier()
call is valid). Since we do not have any constructors defined in the
CICM spec, how are we meant to set read-only member variables (since in
IDL, read-only members only imply _get methods)?

 

Thanks for taking the time to read this,

-Girish