comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Allocators and exceptions
Date: Tue, 11 Sep 2007 12:21:07 -0700
Date: 2007-09-11T12:21:07-07:00	[thread overview]
Message-ID: <1189538467.413193.21430@t8g2000prg.googlegroups.com> (raw)
In-Reply-To: <1189524788.300591.312380@w3g2000hsg.googlegroups.com>

On 11 Wrz, 17:33, Adam Beneschan <a...@irvine.com> wrote:

> It sure seemed to me that one could create an example in which, due to
> a default initialization on a component that contains a function call
> that does some interesting stuff, the automatic reclamation Maciej is
> asking for would lead to a dangling reference or something just as
> bad.

No, there is no such risk. The object that failed to initialized
simply does not exist.

> Maybe something involving a self-pointer in a limited record
> (just to tie it into another thread!).

This limited record does not exist. Its presumably dangling self-
pointer does not exist, neither.
The access to the would-be object is never exposed out of the
allocator, so there is no way for anybody else to get the dangling
pointer.

The possible scenario where it could break could for example involve
the pool: the allocator calls Allocate on the pool and there the pool
registers the access value somewhere; then the initialization fails,
leading to roll-back that includes the call to Deallocate on the same
pool. The pool reclaims memory without unregistering the previously
exposed access value, leading to dangling pointer.

But this is not the problem of the discussed scheme, but rather the
problem of the pool - the same problem would happen with regular new
+Unchecked_Deallocation.

> But I'm still guessing that someone
> could come up with an example that shows that this idea won't work.

For your information, C++ works like that for as long as it has
operator new. If you come up with an example showing that this idea
doesn't work and it's not due to artificially broken environment, I
will ask you to share your findings widely.

Please show me a scheme where the idea breaks, but at the same time
where regular new+Unchecked_Deallocation doesn't.

--
Maciej Sobczak
http://www.msobczak.com/




  reply	other threads:[~2007-09-11 19:21 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-09  7:40 Allocators and exceptions Maciej Sobczak
2007-09-09 12:17 ` anon
2007-09-09 20:31   ` Maciej Sobczak
2007-09-09 22:43     ` Simon Wright
2007-09-10 12:10       ` Maciej Sobczak
2007-09-10 19:08         ` Simon Wright
2007-09-10  2:56     ` anon
2007-09-10 12:42     ` Dmitry A. Kazakov
2007-09-10 21:48       ` Maciej Sobczak
2007-09-11  9:16         ` Dmitry A. Kazakov
2007-09-11  9:19           ` Maciej Sobczak
2007-09-11 12:27             ` Dmitry A. Kazakov
2007-09-11 19:07               ` Maciej Sobczak
2007-09-11 22:56                 ` Georg Bauhaus
2007-09-12 12:36                   ` Maciej Sobczak
2007-09-12 22:19                     ` Randy Brukardt
2007-09-12  9:32                 ` Dmitry A. Kazakov
2007-09-12 12:42                   ` Maciej Sobczak
2007-09-12 15:25                     ` Dmitry A. Kazakov
2007-09-12 12:29             ` Stephen Leake
2007-09-12 12:46               ` Maciej Sobczak
2007-09-12 20:53                 ` Simon Wright
2007-09-12 22:32                   ` Randy Brukardt
2007-09-12 23:43                     ` Simon Wright
2007-09-13  3:42                       ` Randy Brukardt
2007-09-13  3:36                     ` Randy Brukardt
2007-09-13  9:43                     ` Maciej Sobczak
2007-09-12 22:25                 ` Randy Brukardt
2007-09-13 11:51                 ` Stephen Leake
2007-09-12 14:14               ` Markus E L
2007-09-10 10:37 ` Allocators and exceptions => Read Me First anon
2007-09-10 12:16   ` Maciej Sobczak
2007-09-10 22:10     ` Allocators and exceptions => Trying Again anon
2007-09-10 23:15       ` Markus E L
2007-09-10 15:44 ` Allocators and exceptions Adam Beneschan
2007-09-10 21:58   ` Maciej Sobczak
2007-09-10 22:07   ` Jeffrey R. Carter
2007-09-11  9:14   ` Dmitry A. Kazakov
2007-09-11  9:23     ` Maciej Sobczak
2007-09-11  2:36 ` Randy Brukardt
2007-09-11 15:33   ` Adam Beneschan
2007-09-11 19:21     ` Maciej Sobczak [this message]
2007-09-11 21:56     ` Adam Beneschan
2007-09-12  0:34       ` Jeffrey R. Carter
2007-09-12 12:13         ` Maciej Sobczak
2007-09-12 16:34           ` Jeffrey R. Carter
2007-09-12 23:50             ` Jeffrey R. Carter
2007-09-12 12:22       ` Maciej Sobczak
2007-09-12 14:11         ` Markus E L
2007-09-12 16:08         ` Adam Beneschan
2007-09-12 20:35           ` Dmitry A. Kazakov
2007-09-12 21:01             ` Adam Beneschan
2007-09-12 22:45             ` Randy Brukardt
2007-09-13  7:48               ` Dmitry A. Kazakov
2007-09-12  3:08 ` Allocators and exceptions -- Debugging says memory leak! anon
replies disabled

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