comp.lang.ada
 help / color / mirror / Atom feed
From: Pascal Obry <pascal@obry.net>
Subject: Re: newbie: can't read fast enough... :-)    memory leaks...
Date: Wed, 03 Sep 2014 12:17:44 +0200
Date: 2014-09-03T12:17:44+02:00	[thread overview]
Message-ID: <1409739464.7121.235.camel@obry.net> (raw)
In-Reply-To: 479b2efe-0238-4b2a-8b05-cb1a0b4a57e5@googlegroups.com

Le mercredi 03 septembre 2014 à 02:38 -0700, gdotone@gmail.com a
écrit : 
> i know i'll get there, currently in chapter 3, of Ada 95 PSPD, anyway, can Ada code have/produce memory leaks?  well, maybe not "can" it but, does Ada, natively prevent memory leaks?
> 
> like, C seems to leak all over the place, if not managed correctly by the programmer.

This depends on the implementation. Ada make it possible to use a
garbage collector but as far as I know no implementation is using one.
So yes, every Ada compiler around will leak memory if not properly
freed.

To free an allocated object one need to instantiate
Ada.Unchecked_Deallocation.

Note that well designed object can deallocate themselves when possible
by using Ada.Finalization API. As an example, Unbounded_String are using
dynamic allocation but you need need to worry about that as a user.

-- 
  Pascal Obry /  Magny Les Hameaux (78)

  The best way to travel is by means of imagination

  http://v2p.fr.eu.org
  http://www.obry.net

  gpg --keyserver keys.gnupg.net --recv-key F949BD3B




  reply	other threads:[~2014-09-03 10:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03  9:38 newbie: can't read fast enough... :-) memory leaks gdotone
2014-09-03 10:17 ` Pascal Obry [this message]
2014-09-03 10:48   ` G.B.
2014-09-03 15:50     ` Pascal Obry
2014-09-03 17:28     ` Robert A Duff
2014-09-03 17:36       ` Pascal Obry
2014-09-03 19:09         ` gdotone
2014-09-03 19:19           ` gdotone
2014-09-03 19:29             ` Dmitry A. Kazakov
2014-09-03 20:19         ` Robert A Duff
2014-09-03 19:19       ` Dmitry A. Kazakov
2014-09-03 20:31         ` Robert A Duff
2014-09-04  7:18           ` Dmitry A. Kazakov
2014-09-04  4:57   ` Brad Moore
2014-09-04  5:32     ` Jeffrey Carter
2014-09-04  7:23       ` Dmitry A. Kazakov
2014-09-04 14:23       ` Brad Moore
2014-09-04 15:36         ` Brad Moore
2014-09-04 18:28           ` Robert A Duff
2014-09-05  4:58             ` anon
2014-09-05  9:45               ` Simon Wright
2014-09-05 21:54                 ` anon
2014-09-06  6:28                   ` Simon Wright
2014-09-04 15:55         ` G.B.
2014-09-04 16:43         ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox