comp.lang.ada
 help / color / mirror / Atom feed
From: gorgelo@hotmail.com
Subject: Re: Memory pools
Date: Thu, 31 May 2018 12:19:15 -0700 (PDT)
Date: 2018-05-31T12:19:15-07:00	[thread overview]
Message-ID: <d153f8c2-7832-43e7-95a7-750c7425d577@googlegroups.com> (raw)
In-Reply-To: <13ec49fb-8c1a-42a4-b1a2-3984d0e159f7@googlegroups.com>

Den tisdag 29 maj 2018 kl. 21:41:14 UTC+2 skrev John Perry:
> I apologize if this is a dumb question, but:
> 
> I've read that Ada uses memory pools for each type. When I read this, I think it means, for instance, Ada sets up something like an array of 10000 elements for each type, and when the user asks to allocate a new object of such-and-such type, the run-time system hands that to you.
> 
> Is that the idea, or do they mean something else?

The pre-allocations scheme that you think of is the oldest form of memory pools in Ada, already offerred by many Ada 83 compilers and then included in the Ada95 standard. It means that one allocates a bounded amount of memory to an access type (pointer). The idea to do this originates from the observation that an access type (pointer) does not need to have the same life-time as the application. The idea is to define the access type in the beginning of a subprogram and pre-allocate memory to it and then when the access type goes out of scope all heap-memory is deallocation (RAII-pattern again). This simple form of memory pool has since then been generalised.

  parent reply	other threads:[~2018-05-31 19:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 19:41 Memory pools John Perry
2018-05-30  8:14 ` joakimds
2018-05-31 19:15   ` gorgelo
2018-05-31 19:19 ` gorgelo [this message]
2018-05-31 19:28 ` gorgelo
2018-05-31 19:33 ` gorgelo
2018-05-31 21:03   ` Simon Wright
2018-05-31 22:56   ` Randy Brukardt
2018-06-01  5:57     ` gorgelo
2018-06-04 21:14 ` John Perry
replies disabled

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