RosettaCodeData/Task/Memory-allocation/Ada/memory-allocation-3.ada

9 lines
242 B
Ada

declare
type Integer_Ptr is access Integer;
procedure Free is new Ada.Unchecked_Deallocation (Integer, Integer_Ptr)
Ptr : Integer_Ptr := new Integer; -- Allocated in the heap
begin
Free (Ptr); -- Explicit deallocation
...
end;