comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex R. Mosteo" <devnull@mailinator.com>
Subject: Re: Not null feature with anonymous and named access types
Date: Wed, 14 Jun 2006 17:13:17 +0200
Date: 2006-06-14T17:13:17+02:00	[thread overview]
Message-ID: <4fana1F1i8fppU1@individual.net> (raw)
In-Reply-To: 1150212476.630345.297100@c74g2000cwc.googlegroups.com

Anh Vo wrote:

> 
> Dmitry A. Kazakov wrote:
>> On 12 Jun 2006 16:13:34 -0700, Anh Vo wrote:
>>
>> > Bj�rn 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
>> very 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.

I don't see anything has radically changed in this respect since Ada95. You
expose in the spec a not null type and in body use some nullable type for
unchecked deallocations, if necessary. 



  reply	other threads:[~2006-06-14 15:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-12 20:33 Not null feature with anonymous and named access types Anh Vo
2006-06-12 21:26 ` Björn Persson
2006-06-12 23:13   ` Anh Vo
2006-06-13  7:53     ` Dmitry A. Kazakov
2006-06-13 15:27       ` Anh Vo
2006-06-14 15:13         ` Alex R. Mosteo [this message]
2006-06-14 15:37           ` Anh Vo
2006-06-14 17:00             ` Dmitry A. Kazakov
2006-06-15  3:48               ` Anh Vo
2006-06-15  8:21                 ` Dmitry A. Kazakov
2006-06-17  1:21                   ` Randy Brukardt
2006-06-17  8:24                     ` Dmitry A. Kazakov
2006-06-17 14:24                     ` Robert A Duff
2006-06-19 23:17                       ` Randy Brukardt
2006-06-15 10:50                 ` Alex R. Mosteo
2006-06-17  1:16 ` Randy Brukardt
2006-06-17 14:25   ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox