Version 1.1 of ai05s/ai05-0189-1.txt
!standard D.7 (19.1/2) 09-11-03 AI05-0189-1/01
!class amendment 09-11-03
!status work item 09-11-03
!status received 09-11-03
!priority Low
!difficulty Easy
!subject Restriction No_Allocators_After_Elaboration
!summary
Provide a restriction that disallows use of allocators after
library unit elaboration is complete.
!problem
It is quite common that a resource-constrained long-lived application wants to
avoid any heap allocation after library unit elaboration is complete,
to ensure that there is no heap growth during the ongoing execution of
the program.
!proposal
(see summary)
!wording
Add after D.7(19.1/2):
No_Allocators_After_Elaboration
Specifies that the only allocators that may be evaluated during the
execution of the partition are within the execution of the
environment task, during the elaboration of the library_items of
the partition, prior to the invocation of any main subprogram. An
allocator shall not occur within a task body or the main
subprogram. If an implementation chooses to detect a violation of
this restriction at run-time, Storage_Error should be raised;
otherwise the behavior is implementation defined.
!discussion
For simplicity, we have restricted allocators to the environment task,
even though it might be possible for a non-environment task to execute
entirely during library-item elaboration. This also eliminates the need
for synchronization during heap allocation.
We do not require this restriction to be entirely enforced prior to
execution. We perhaps could do so, but to do it completely
could require significant static analysis.
!examples
** TBD **
!ACATS test
ACATS B and C tests are needed.
!appendix
****************************************************************
Questions? Ask the ACAA Technical Agent