PowerAda 103

From OC Systems Wiki!
< PowerAda:APPENDIX C. Implementation Characteristics‎ | Annex M
Revision as of 00:31, 24 April 2019 by imported>WikiVisor (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

(103) Any operations that implicitly require heap storage allocation.

See D.7(8).

The following runtime calls and operations will allocate memory from the heap:

  • Unconstrained function returns where the returned object is greater then 150 bytes allocate space from the heap. The space is returned after it is no longer needed.
  • Subunit and instance package bodies that declare objects that are not constrained until runtime allocate space from he heap for the objects.
  • Task creation allocates space from the heap for a Task Control Block. Each entry declared in a task requires a control block that is also allocated from the heap.
  • Controlled types.
  • Calls to Ada.Exceptions.Save_Occurrence will return an object that is allocated from the heap.
  • Calls to System.AIX_Environment_Variables.Export will return an object that is allocated from the heap.
  • The declaration of the type Ada.Numerics.Float_Random.Generator allocates memory from the heap and declares a controlled type that also involves an allocation.
  • Exceptions that propagate out of task entry calls when the entry call was part of n asynchronous select statement will allocate space from the heap to store exception information.
  • Attaching an interrupt to a protected procedure via Pragma Attach_Handler or Pragma Interrupt_Handler allocates space from the heap.
  • The package Ada.Strings.Unbounded will allocate space from the heap for strings that are longer then 30 bytes. These longer strings are embedded in a controlled record (so they can be reclaiming) and thus require additional heap allocations.
  • In the package Ada.Strings.Wide_Maps the type Wide_Character_Set is declared (in the private section) to be a controlled type with a pointer to a Wide_Character_Range. All functions in this package that return objects of this type will involve several allocations of space from the heap.
  • The package Posix declares a limited private type POSIX_String_List that is completed as Access to a POSIX_List. Thus the function Append will allocate space for a Posix_String.
  • The package POSIX.Process_Environment declares a limited private type Environment this is completed as Access to an internal type. Thus the following subprograms in this package allocate space from the heap:
    • Get_Current_Environment - for the first time an non-empty environment is to be returned.
    • Copy_Environment - when the environment to be copied is not empty.
    • Set_Environment_Variable - when the environment is currently empty; for the new environment value.
  • The package POSIX.Process_Primitives declares a limited private type Process_Template this is completed as Access to an internal type. Thus the following subprograms in this package allocate space from the heap
    • Open_Template - if the Template passed in is null space for a new template is allocated from the heap.
    • Check_Child_Status - if the child is terminated space for the status is allocated from the heap.
  • When the POSIX.Signals package is elaborated it allocates space for the strings representing the ASCII names for all the AIX signals.
  • Two routines in POSIX.Unsafe_Process_Primitives allocate space from the heap:
    • Allocate_C_String
    • Allocate_C_String_Pointer_Array
  • The package Ada.Task_Attributes contains several routines that can allocate space from the heap:
    • Calls to Set_Value will allocate space for the attribute.
    • Calls to Reference, when the given attribute is set to the Initial_Value, will allocate space from the heap for a copy of the Initial_Value (see LRM C.7.2:28).
    • The first time a task has an attribute set for it an allocation from the heap is made to get space for an array to hold all attributes for that task. Note that calling Reference for a task that has never had an attribute set for it will also cause this array to be created. One other allocation is also made at this point.
  • The packages Text_Io and Wide_Text_Io has a number of places where space is allocated from the heap:
    • Opening or creating a file results is several allocations.
    • Input and output is buffered and the buffers are allocated from the heap.
  • The portions of the runtime that support the fixed and floating point attributes allocate space from the heap.