From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e7d9fee9b42cd34e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!c74g2000cwc.googlegroups.com!not-for-mail From: "Anh Vo" Newsgroups: comp.lang.ada Subject: Re: Not null feature with anonymous and named access types Date: 13 Jun 2006 08:27:56 -0700 Organization: http://groups.google.com Message-ID: <1150212476.630345.297100@c74g2000cwc.googlegroups.com> References: <1150144396.104055.164310@f6g2000cwb.googlegroups.com> <6_kjg.4603$E02.1474@newsb.telia.net> <1150154013.951160.154270@j55g2000cwa.googlegroups.com> <15d5p0cbyr817.1vzzowtu2dayj$.dlg@40tude.net> NNTP-Posting-Host: 209.225.227.29 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1150212481 18667 127.0.0.1 (13 Jun 2006 15:28:01 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 13 Jun 2006 15:28:01 +0000 (UTC) In-Reply-To: <15d5p0cbyr817.1vzzowtu2dayj$.dlg@40tude.net> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: c74g2000cwc.googlegroups.com; posting-host=209.225.227.29; posting-account=JVr7Xg0AAAAI3MbuARxMmvWLmA7qdJMx Xref: g2news2.google.com comp.lang.ada:4759 Date: 2006-06-13T08:27:56-07:00 List-Id: Dmitry A. Kazakov wrote: > On 12 Jun 2006 16:13:34 -0700, Anh Vo wrote: > > > Bj=F6rn Persson wrote: > >> Anh Vo wrote: > >>> I have been exploring the not null feature with anonymous access type > >>> and named access type. One thing have learned that an access variable > >>> declared based on these types will raise a Constraint_Error when > >>> deallocating this access variable as shown in the code below. > >> > >> Of course. Deallocation sets the access variable to null, and that > >> violates the not-null constraint. > >> > > Thanks for your quick reply. > > > > Based on this requirement, one should not use not null access in this > > case due to memory leak as the result of memory deallocation > > incapability. > > Often memory management and handling objects should be well separated. In > public interfaces, where pointers are needed, null access types can be ve= ry > useful. This by no means should prevent the implementation interfaces from > using plain pointers, arena allocators, garbage collectors, etc to manage > memory. Agreed. However, memory leak occurs when the scope is complete in this case. Therefore, not null access should be used with extreme care. Otherwise, memory leak is almost certain. AV