comp.lang.ada
 help / color / mirror / Atom feed
From: jcallen@Encore.COM (Jerry Callen)
Subject: Interpretation of LRM 13.10.1
Date: 27 Feb 90 15:50:42 GMT	[thread overview]
Message-ID: <11249@encore.Encore.COM> (raw)
In-Reply-To: D41AC33FCEFF000A65@KVI.nl

In article <foo> F.Zwarts@KVI.NL ("Fred Zwarts, KVI, Groningen, NL.") writes:

>I am uncertain about the interpretation of LRM 13.10.1(8) on the
>UNCHECKED_DEALLOCATION procedure, where I read:
>
>"If X designates a task object, the call FREE(X) has no effect on the task
>...".
>
>My question is: What means "no effect"?
>Suppose X designates a terminated task, see LRM 9.4(6-10).
>Can FREE(X) be used to reclaim memory held by such a terminated task, like a
>task control block? Does the LRM allow such an interpretation?

The "no effect" statement means that freeing a task object won't do
something unpleasant to it (like free its stacks/control blocks out from
under it).

You can't really reclaim ALL of the storage associated with a task until the
task's scope disappears, even in the case of a task created with an allocator;
there may be other copies of the pointer floating around, and the owners of
those copies may (erroneously) query the 'CALLABLE/'TERMINATED attributes
of the task. You could argue that, by using Unchecked_Deallocation, you are
explicitly telling the RTS that there are no dangling pointers, but I
think it's safer for the RTS to assume that there might be. Note that a
clever implementation will release nearly all of the storage associated with
a task (stacks, most control blocks, etc.) at task completion; all that really
has to hang around is a stub of the TCB that can be used to implement the
above attributes.

>If this interpretation is not allowed, I can imagin a case in which one runs
>out of memory because of a large amount of terminated tasks. If always at least
>one such task is running, it is not possible to leave the block in which the
>declaration of X's type was elaborated LRM 9.4(6), which could otherwise be a
>way to reclaim memory.

Hopefully your RTS is going to free as much storage as it can at task
completion. Trying to "help it" with Unchecked_Deallocation is probably
useless.

>Fred Zwarts                             E-mail:         INFOADA@KVI.nl
>Kernfysisch Versneller Instituut
>9747 AA  Groningen
>The Netherlands

-- Jerry Callen
   jcallen@encore.com
   (508) 460-0500

  reply	other threads:[~1990-02-27 15:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-02-23 15:48 Interpretation of LRM 13.10.1 "Fred Zwarts, KVI, Groningen, NL."
1990-02-27 15:50 ` Jerry Callen [this message]
1990-03-02 18:21   ` stt
1990-03-05 17:01     ` John Goodenough
1990-02-27 19:47 ` Loren Louis Hart
  -- strict thread matches above, loose matches on Subject: below --
1990-02-27 14:15 Mats Weber
1990-02-27 14:51 "Norman H. Cohen"
replies disabled

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