comp.lang.ada
 help / color / mirror / Atom feed
From: Peter Schildmann <news@schildmann.info>
Subject: Re: Size of Vector limited to 1024 MB of Heap Size
Date: Tue, 24 Jun 2008 20:55:31 +0200
Date: 2008-06-24T20:55:31+02:00	[thread overview]
Message-ID: <6ccu94F3et2evU1@mid.individual.net> (raw)
In-Reply-To: <g3qc68$5a5$1@aioe.org>

Dennis Hoppe schrieb:
>   loop
>     Generic_Vector.Append (Evil_Vector, Integer'Last);
>   end loop;

It's not a good idea to use the STORAGE_ERROR exception
to terminate an endless loop.

This should work:

with Ada.Text_IO;
with Ada.Containers;
with Ada.Containers.Vectors;

procedure Heap is

   package Cnt_IO is new Ada.Text_IO.Integer_IO
     (Ada.Containers.Count_Type);

   package Generic_Vector is new Ada.Containers.Vectors
     (Element_Type => Integer, Index_Type => Natural);

   Evil_Vector : Generic_Vector.Vector;

   Size : constant := Integer'Size / Standard'Storage_Unit;

begin

   for N in 0 .. Natural'Last / Size loop
      Generic_Vector.Append (Evil_Vector, N);
   end loop;

   Cnt_IO.Put (Generic_Vector.Capacity (Evil_Vector));

end Heap;


- Peter



  parent reply	other threads:[~2008-06-24 18:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-24  8:44 Size of Vector limited to 1024 MB of Heap Size Dennis Hoppe
2008-06-24 15:03 ` Adam Beneschan
2008-06-24 17:32 ` Robert A Duff
2008-06-24 18:55 ` Peter Schildmann [this message]
2008-06-25 15:13   ` Dennis Hoppe
2008-06-25 17:26     ` (see below)
2008-06-25 21:09       ` Dennis Hoppe
2008-06-24 20:03 ` Gene
2008-06-24 20:38   ` Robert A Duff
2008-06-24 22:53 ` anon
2008-06-24 23:36   ` Extra footnote: " anon
2008-06-25  0:11     ` tmoran
2008-06-25  2:49       ` anon
2008-06-25  8:04         ` christoph.grein
2008-06-25 10:39 ` Peter Schildmann
2008-06-25 15:29   ` Dennis Hoppe
replies disabled

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