comp.lang.ada
 help / color / mirror / Atom feed
From: Duncan Sands <baldrick@free.fr>
To: "Steve Adams" <s.adams_s_p_a_m_217@_s_p_a_m_ntlworld.csopam>,
	comp.lang.ada@ada-france.org
Subject: Re: C array to Ada pointer to unconstrained array without copyingmemory
Date: Fri, 10 Oct 2003 09:02:23 +0200
Date: 2003-10-10T09:02:23+02:00	[thread overview]
Message-ID: <mailman.57.1065769242.25614.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <pLlhb.1420$7b5.1241@newsfep1-gui.server.ntli.net>

> Freeing a fat pointer with unchecked_deallocation is a good question, I
> would guess that it does free correctly. However its any ones guess outside
> of Gnat whether the data is freed in one call or as two. If two I am in
> trouble :)
>
> However, every time i traced the use of these things the bounds were ALWAYS
> immediately before the data in memory, suggesting a single allocation from
> the heap.

Yes, it seems like an obvious optimization: arrays allocated on the heap can have
no address clause, so you can put the bounds with the data if you like, and reduce
the number of memory allocations.  Also, if the bounds are immediately before the
data, doesn't that prove that it was done in one memory allocation, since (IIRC)
malloc reserves some bytes for itself just before a block of memory it allocates, and
GNAT uses malloc?

Ciao,

Duncan.




  reply	other threads:[~2003-10-10  7:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-07 14:43 C array to Ada pointer to unconstrained array without copying memory Duncan Sands
2003-10-07 18:30 ` tmoran
2003-10-07 19:24   ` Duncan Sands
2003-10-08  0:02   ` sk
     [not found]   ` <3F83540E.5000302@myob.com>
2003-10-08  9:18     ` Duncan Sands
2003-10-07 20:00 ` Jeffrey Carter
2003-10-07 20:39   ` Duncan Sands
2003-10-08  1:27     ` Jeffrey Carter
2003-10-07 20:53 ` Chad R. Meiners
2003-10-07 21:24   ` Duncan Sands
2003-10-07 22:44     ` C array to Ada pointer to unconstrained array without copyingmemory Chad R. Meiners
2003-10-07 22:52       ` Chad R. Meiners
2003-10-08  9:20         ` Duncan Sands
2003-10-08 16:16           ` C array to Ada pointer to unconstrained array withoutcopyingmemory Chad R. Meiners
2003-10-08 16:49             ` Duncan Sands
2003-10-08  2:14     ` C array to Ada pointer to unconstrained array without copying memory Robert I. Eachus
2003-10-08  9:27       ` Duncan Sands
2003-10-08 22:43         ` Robert I. Eachus
2003-10-09  9:31           ` Duncan Sands
2003-10-08 14:07 ` Steve Adams
2003-10-08 14:33   ` Preben Randhol
2003-10-09 23:04     ` Steve Adams
2003-10-09 23:11       ` Steve Adams
2003-10-08 16:30   ` Duncan Sands
2003-10-09 22:59     ` C array to Ada pointer to unconstrained array without copyingmemory Steve Adams
2003-10-10  7:02       ` Duncan Sands [this message]
2003-10-10 16:44         ` C array to Ada pointer to unconstrained array withoutcopyingmemory Steve Adams
2003-10-23 21:27   ` C array to Ada pointer to unconstrained array without copying memory Craig Carey
replies disabled

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