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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no 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-14 21:40:50 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!newsfeed.online.be!newsgate.cistron.nl!psiuk-p2!psiuk-p3!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: memory leakages with Ada? Date: Thu, 14 Mar 2002 15:12:21 -0500 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: References: <3c90af1e@news.starhub.net.sg> NNTP-Posting-Host: dhcp-200-133.miami.pace.co.uk X-Trace: nh.pace.co.uk 1016136741 7634 136.170.200.133 (14 Mar 2002 20:12:21 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 14 Mar 2002 20:12:21 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:21261 Date: 2002-03-14T20:12:21+00:00 List-Id: In comparing Ada to C on this there are two observations: One is that Ada provides a different model for dynamic allocation than does C that includes, among other things, a lot more checks/safety features to minimize the possibility of lost memory. (Still, the standard doesn't require garbage collection so you can still leak memory if you mess things up.) It isn't impossible to leak memory in Ada - just less likely. The other thing is that stylistically, Ada tends to do things off of the stack or global memory rather than require lots of dynamic allocation. Short of building your own linked data structures, you generally almost *never* create things via dynamic allocation. (Constrast this with C where you routinely do dynamic allocation of strings or structs and routinely manage pointers to all sorts of things.) If you find you are constantly dynamically allocating things in your Ada programs, you are probably not doing it The Ada Way (trying to translate C into Ada?) and need to rethink what you're doing. As a result, memory leaks are far less frequent in Ada programs, so you'll save lots of nasty debugging time. As for interfacing to C - the C code is free to leak all the memory it wants so you get no guarantees. It may also depend on the compiler(s) in question. MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Calvin Ow" wrote in message news:3c90af1e@news.starhub.net.sg... > Hi, > Has Ada got any memory leakage problems like that of C? > Especially with the use of Pragma calls to C? > >