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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham 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!news3.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!fdn.fr!club-internet.fr!feedme-small.clubint.net!feeder.news-service.com!tudelft.nl!txtfeed1.tudelft.nl!feeder3.cambrium.nl!feed.tweaknews.nl!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Question about arrays and no. of elements References: Date: Sat, 17 May 2008 19:37:53 +0200 Message-ID: <87lk28u8zy.fsf@ludovic-brenta.org> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:SEmTejeiMxCBGnIoGj9gMj9B7oM= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Tele2 X-Trace: DXC=h\g0@Ij5^FKa\Mo6Y1n?[C6`Y6aWje^YJaCegdR=F`RO6[b\^[?Bi5FNTK^2VoJ@?O Xref: g2news1.google.com comp.lang.ada:168 Date: 2008-05-17T19:37:53+02:00 List-Id: Jacob Sparre Andersen writes: > amal.alphonse 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)? > > With GNAT on Linux, you will only use memory for the part of the array > you put something into (modulo the page size - which I think is 4 kb). Actually, that's a kernel feature (commit-on-write) independent of the compiler. -- Ludovic Brenta.