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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,345a8b767542016e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-15 10:06:41 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator-SanJose!in.nntp.be!easynews!uunet!dfw.uu.net!ash.uu.net!spool0900.news.uu.net!reader0901.news.uu.net!not-for-mail Message-ID: <3C9238A5.7060700@mail.com> Date: Fri, 15 Mar 2002 13:08:37 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.9) Gecko/20020311 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: memory leakages with Ada? References: <3c90af1e@news.starhub.net.sg> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Cache-Post-Path: master.nyc.kbcfp.com!unknown@mosquito.nyc.kbcfp.com X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1016215599 reader1.ash.ops.us.uu.net 1909 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:21304 Date: 2002-03-15T13:08:37-05:00 List-Id: Kevin Cline wrote: > So dynamic memory allocation is no problem in Ada because "we just don't > do that?" That's fine for embedded applications, but the users of desktop > applications expect them to consume memory proprotional to the data > set size. They aren't too happy with messages like "sorry, file too large, > please increase DATA_FILE.MAX_SIZE and recompile." That's not what he said. In Ada you can declare arrays whose size depends on expressions evaluated at runtime, whereas in C89/C++ (but not C99) array sizes must be constant expressions. Therefore situations which call for buffers whose size depends on some external value can be handled cleanly in Ada by just reading that external value and using it to declare an array whose size depends on it. If you actually need to store these variably-sized objects then of course you will need dynamic allocation, but often you just need to read an object, process it, and dispose of it, and then you can sometimes avoid the allocation.