From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f31af493775a063b X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news3.google.com!news2.google.com!news1.google.com!news.glorb.com!wn11feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Question about arrays and no. of elements Reply-To: anon@anon.org (anon) References: X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Thu, 15 May 2008 16:50:35 GMT NNTP-Posting-Host: 12.65.18.8 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1210870235 12.65.18.8 (Thu, 15 May 2008 16:50:35 GMT) NNTP-Posting-Date: Thu, 15 May 2008 16:50:35 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:79 Date: 2008-05-15T16:50:35+00:00 List-Id: Arrays should be created for the number of element used in the program with allowances for normal growth of data though the lifecycle of the program. For a array of 10 elements it might be easier and more efficient to request an array size that fits on a memory page bounds, such as array size that would fit into a 256 or 512 sector page or a 1 to 4 KB block. Efficiency of execution depending on how you allocate the array. Plus, Array are created before they can be used. If the compiler creates the million element array then the OS will first have to allocate space and load the array into memory (real or virtual), if possible. Then the system will load the entire program with array into memory. Now, if array is created during program initialization after loaded into memory. The Ada run-time system will try to allocate the space by make a request to the OS for memory, if allocated, the run-time simply returns and program continues. But if memory was not allocated then STORAGE_ERROR will be the result. In , amal.alphonse@gmail.com writes: >If I define an array with say a million elements, and I only put data >in 10 of them, is it actually a waste of space/time with the array or >does Ada only create elements when there is data to put in (so it is >efficient)?