comp.lang.ada
 help / color / mirror / Atom feed
From: "patrick.gunia@googlemail.com" <patrick.gunia@googlemail.com>
Subject: Re: Problems with Scope of aliased Objects
Date: Thu, 16 Apr 2009 09:37:47 -0700 (PDT)
Date: 2009-04-16T09:37:47-07:00	[thread overview]
Message-ID: <31f131d9-89fa-4d88-97d8-f478ab30ebdb@h2g2000yqg.googlegroups.com> (raw)
In-Reply-To: 7f791896-0395-4471-910f-afaf8a488a13@r31g2000prh.googlegroups.com

On 16 Apr., 18:26, Adam Beneschan <a...@irvine.com> wrote:
> On Apr 16, 8:59 am, "patrick.gu...@googlemail.com"
>
> > Alright, this was my explanation. I forgot the fact, that the values
> > are copied into the array. The simple reason why I didn´t want to use
> > heap-memory is the performance-aspect. My third approach works using
> > "new" to allocate heap-memory dynamically. In this case, adding the
> > access-type into the array leads to a copy of the heap-memory-adress
> > where the object was created. This address is copied into the array
> > and thus still reachable. To cut a long story short, my second
> > approach simply won´t work because of dangling pointers which point to
> > memory which isn´t assigned any longer (at least not to the objects I
> > expect to be there). Do I have to be afraid of runtime-performance-
> > problems when using dynamic allocation in Ada?
>
> I don't know.  That will depend on which implementation of Ada you use
> and just what your performance requirements are.  If it's really a
> concern, you can set up your own storage pool, with your own
> allocation and deallocation routines, and tell the compiler that any
> time you use "new" for certain access types, they will use that pool.
> Then you can optimize the pool routines and tailor them to the
> specific way you will use it (for example, if you never deallocate
> anything, you can take advantage of that fact to simply the Allocate
> routine; or you can organize the pool so that all objects of the same
> size will be next to each other, which could lead to a more efficient
> implementation).  Storage pools are explained in 13.11 of the RM, and
> there may be other helpful resources, and I'm sure there are publicly
> available examples of storage pools that you can use or modify---but I
> don't know where they are, so hopefully someone else can point you to
> them.
>
>                               -- Adam

Alright, then I think I´ll search some ressources concerning storage
pools. I use GNAT 3.4.5 (mingw-vista special r3) with Ada95. Indeed I
deal with a situation in which the dynamic-allocation is performed
while initializing the software and freed when shutting it down. Thus
I usually don´t have to deallocate the dynamically allocated memory as
the runtime-system frees it at program-shutdown. This might be a
starting-point for optimization.
Thank you!



  reply	other threads:[~2009-04-16 16:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-16 13:43 Problems with Scope of aliased Objects patrick.gunia
2009-04-16 15:29 ` Adam Beneschan
2009-04-16 15:59   ` patrick.gunia
2009-04-16 16:26     ` Adam Beneschan
2009-04-16 16:37       ` patrick.gunia [this message]
2009-04-16 20:11       ` Adam Beneschan
2009-04-16 15:47 ` Dmitry A. Kazakov
2009-04-16 19:12   ` sjw
2009-04-16 15:50 ` Ludovic Brenta
2009-04-16 16:01   ` Adam Beneschan
2009-04-16 16:12     ` patrick.gunia
2009-04-17 13:53       ` Alex R. Mosteo
replies disabled

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