From 787d23bb338946766a57c74cd7b5459ae6fd0b05 Mon Sep 17 00:00:00 2001 From: Erik <18669618+etomzak@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:01:00 +0100 Subject: [PATCH 1/2] Improve default allocator wording --- adoc/chapters/programming_interface.adoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 2332823d..61edc1f5 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -4918,8 +4918,10 @@ STL-based libraries (e.g, Intel's TBB provides an allocator). ==== Default allocators A default allocator is always defined by the implementation. -For allocations greater than size zero, when successful it is guaranteed to -return non-[code]#nullptr# and new memory positions every call. +For successful allocations of size greater than zero, the default allocator must +return a pointer to a contiguous, exclusive region of memory of at least the +requested size. +For unsuccessful allocations, the default allocator must return [code]#nullptr#. The default allocator for const buffers will remove the const-ness of the type (therefore, the default allocator for a buffer of type [code]#const int# will be an [code]#Allocator)#. From 3a28a0b8c49be73d1fd972357790a3b91c6b9856 Mon Sep 17 00:00:00 2001 From: Erik <18669618+etomzak@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:48:47 +0000 Subject: [PATCH 2/2] Remove confusing wording --- adoc/chapters/programming_interface.adoc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 61edc1f5..3719f77c 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -4889,11 +4889,9 @@ can supply their own allocator class. } ---- -When an allocator returns a [code]#nullptr#, the runtime cannot allocate data on -the host. -Note that in this case the runtime will raise an error if it requires host -memory but it is not available (e.g when moving data across <> -contexts). +Note that if the runtime requires host memory (e.g., when moving data across +<> contexts), but the allocator fails to allocate the memory, then the +runtime will raise an error. In some cases, the implementation may retain a copy of the allocator object even after the buffer is destroyed. @@ -4918,10 +4916,6 @@ STL-based libraries (e.g, Intel's TBB provides an allocator). ==== Default allocators A default allocator is always defined by the implementation. -For successful allocations of size greater than zero, the default allocator must -return a pointer to a contiguous, exclusive region of memory of at least the -requested size. -For unsuccessful allocations, the default allocator must return [code]#nullptr#. The default allocator for const buffers will remove the const-ness of the type (therefore, the default allocator for a buffer of type [code]#const int# will be an [code]#Allocator)#.