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,3f0365b3a22c7556 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!LF.net!news.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: Heap vs Stack allocation Date: Wed, 12 Oct 2005 14:35:42 +0200 Message-ID: <87d5magbfl.fsf@mid.deneb.enyo.de> References: <434c2709$0$21298$626a54ce@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: albireo.enyo.de 1129120597 31741 212.9.189.177 (12 Oct 2005 12:36:37 GMT) X-Complaints-To: Cancel-Lock: sha1:V0rO9HhSFOchMENMoUBIqjeEMN8= Xref: g2news1.google.com comp.lang.ada:5557 Date: 2005-10-12T14:35:42+02:00 List-Id: * Lionel Draghi: > Am I right, or is this "Escape Analysis" something really powerful? Depends on your coding style. The savings could be significant for some uses of Unbounded_String, for example. It might also be faster to return a pointer to heap object (which is in fact region or stack allocated) than to return the unconstrained object itself, if this saves a few copies. All in all, I would expect that most Ada code is far less demanding than Java code as far as the memory allocate is concerned (assuming that you use a compiler which can allocate unconstrained objects on the stack).