comp.lang.ada
 help / color / mirror / Atom feed
From: kassover@minerva.crd.ge.com (David Kassover)
Subject: Re: C Strings in Ada?
Date: 11 Jun 90 21:01:13 GMT	[thread overview]
Message-ID: <8462@crdgw1.crd.ge.com> (raw)
In-Reply-To: 57288@bbn.BBN.COM

In article <57288@bbn.BBN.COM> adoyle@vax.bbn.com (Allan Doyle) writes:
...
>When I am using the Ada "new" keyword, I know full well that I'm creating
>potential for garbage. I can control when I call it. I can write my own
>memory manager around it. I don't get that control when I need a construct
>like
>
>	declare
>		c_string : constant string := "foo" & ascii.nul;
>	begin
>		<stuff>
>	end;

I'll ask for some clarification from the language lawyers (and
others who have experience with specific Ada environments other
than VAX Ada)

but I don't think garbage collection in this instance was ever an
issue.

That is, I have used similar constructs (and rather large ones,
too: potential to store 90000 g_floats) in VAX Ada.  It, so far,
has appeared that when the declared variables go out of scope,
the memory is returned to "the system".

On the other hand, stuff that is created with NEW is often
intended *not* to go out of scope, so unchecked_deallocation is
needed to get rid of it (presumably, *after* the program has
verified that "no one else" still points to it)

And furthermore, I remember having a discussion about this about
a year ago, before I implemented the monster data structure (we
use it to pass potentially large arrays to and from a FORTRAN
program, especially in instances where it is hard for the Ada
code to determine the dimensions of the array.  I was assured
that exhaustion of "heap space" would not be a problem, given
that there was enough heap available for any one scope.  But
again, that may be a "feature" of VAX Ada's way of dealing with it.

--
David Kassover             "Proper technique helps protect you against
kassover@ra.crd.ge.com	    sharp weapons and dull judges."
kassover@crd.ge.com			F. Collins

  reply	other threads:[~1990-06-11 21:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-06-04 22:45 C Strings in Ada? Andy DeFaria
1990-06-07 17:41 ` stt
1990-06-08 16:00 ` Andy DeFaria
1990-06-10 20:38   ` Alex Blakemore
1990-06-11 12:57     ` Allan Doyle
1990-06-11 14:59       ` David Kassover
1990-06-11 19:48         ` Allan Doyle
1990-06-11 21:01           ` David Kassover [this message]
1990-06-11 22:30           ` Mike Murphy
1990-06-13 21:20           ` Edward Falis
1990-06-11 17:53       ` David Emery
1990-06-11 19:59         ` Allan Doyle
1990-06-15  7:53   ` Jeff Bartlett
1990-06-11 22:39 ` Andy DeFaria
1990-06-12 14:04   ` David Emery
1990-06-12 18:11   ` Mike Murphy
1990-06-13 13:43 ` stt
replies disabled

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