From: Andy Askey <ajaskey@mindspring.com>
Subject: Unconstrained type Unchecked_Deallocation
Date: 2000/03/05
Date: 2000-03-05T23:17:38+00:00 [thread overview]
Message-ID: <lup5csoc69dj9ko2q7fbdduf8n0i4h09ll@4ax.com> (raw)
I have a byte array type that is used to generate byte-arrays
dynamically. I want to dynamically deallocate these byte-arrays. Can
I use the following to deallocate memory?
If not, any suggestions?
package tst_pkg is
type Byte_Atype is array (integer range <>) of character;
type Byte_Ptype is access Byte_Atype;
procedure Free(The_Array : in out Byte_Ptype);
end tst_pkg;
package body tst_pkg is
procedure Deallocate is new Ada.Unchecked_Deallocation(
Byte_Atype, Byte_Ptype);
procedure Free(The_Array : in out Byte_Ptype) is
begin
Deallocate(The_Array);
end;
end tst_pkg;
The real question is will the Free procedure deallocate all the bytes
allocated with the following?
my_bytes : Byte_Ptype;
begin
my_bytes := new Byte_Atype(1..100);
tst_pkg.Free(my_bytes);
end;
Thanx. Andy
--
Andy Askey
ajaskey@mindspring.com
next reply other threads:[~2000-03-05 0:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-05 0:00 Andy Askey [this message]
2000-03-06 0:00 ` Unconstrained type Unchecked_Deallocation Ted Dennison
2000-03-06 0:00 ` tmoran
2000-03-06 0:00 ` John English
2000-03-06 0:00 ` Ted Dennison
[not found] ` <38C566CE.6283C0AD@rational.com>
2000-03-08 0:00 ` Robert Dewar
2000-03-08 0:00 ` Larry Kilgallen
2000-04-05 0:00 ` Robert I. Eachus
2000-04-06 0:00 ` P. S. Norby
2000-04-06 0:00 ` Robert Dewar
2000-04-09 0:00 ` Robert I. Eachus
2000-04-09 0:00 ` Robert Dewar
2000-04-12 0:00 ` Robert I. Eachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox