Deprecate "address", "size" and "(de)allocate_many" functions from allocators.

This commit is contained in:
Ion Gaztañaga
2026-01-10 22:58:33 +01:00
parent 9f1c4b21b3
commit 9d5a312a8b
9 changed files with 67 additions and 21 deletions

View File

@@ -6878,9 +6878,12 @@ thank them:
* Changed the interface of [link managed_memory_segment_advanced_features.managed_memory_segment_multiple_allocations Multiple allocation functions]
(still experimental and API/ABI unstable) to support alignment.
Added `BOOST_HEADER_DEPRECATED` to `<boost/interprocess/containers/*.hpp> headers. They were deprecated several releases ago, but this
* Added `BOOST_HEADER_DEPRECATED` to `<boost/interprocess/containers/*.hpp> headers. They were deprecated several releases ago, but this
message will annoy existing users to switch to Boost.Container headers.
* Deprecated `size()`, `allocate_many` and `deallocate_many`, `address` and `size` functions for allocators. They were not used in
Boost.Container and will be removed in the future.
* Fixed bugs:
* [@https://github.com/boostorg/interprocess/issues/242 GitHub #242 (['"Cygwin compatibility issues"])].
* [@https://github.com/boostorg/interprocess/issues/247 GitHub #247 (['"destruction of move-constructed map using private_adaptive_pool triggers Assertion"])].

View File

@@ -425,10 +425,12 @@ class adaptive_pool
//!Returns address of mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
pointer address(reference value) const;
//!Returns address of non mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
const_pointer address(const_reference value) const;
//! <b>Requires</b>: Uses-allocator construction of T with allocator argument
@@ -447,22 +449,22 @@ class adaptive_pool
//!Returns maximum the number of objects the previously allocated memory
//!pointed by p can hold. This size only works for memory allocated with
//!allocate, allocation_command and allocate_many.
//!This function is deprecated and will be removed in the future
size_type size(const pointer &p) const;
pointer allocation_command(boost::interprocess::allocation_type command,
size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse);
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
//!the preferred and maximum number is
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!with deallocate(...).
//!This function is deprecated and will be removed in the future
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
//!This function is deprecated and will be removed in the future
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
@@ -471,6 +473,7 @@ class adaptive_pool
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function

View File

@@ -215,7 +215,9 @@ class allocator
//!Returns maximum the number of objects the previously allocated memory
//!pointed by p can hold. This size only works for memory allocated with
//!allocate, allocation_command and allocate_many.
//!This function is deprecated and will be removed in the future
BOOST_INTERPROCESS_NODISCARD
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
size_type size(const pointer &p) const
{
return (size_type)mp_mngr->size(ipcdetail::to_raw_pointer(p))/sizeof(T);
@@ -237,6 +239,8 @@ class allocator
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain)
{
if(size_overflows<sizeof(T)>(elem_size)){
@@ -248,6 +252,8 @@ class allocator
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
//!This function is deprecated and will be removed in the future
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain)
{
mp_mngr->allocate_many(elem_sizes, n_elements, sizeof(T), boost::container::dtl::alignment_of<T>::value, chain);
@@ -259,6 +265,8 @@ class allocator
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
void deallocate_many(multiallocation_chain &chain)
{ mp_mngr->deallocate_many(chain); }
@@ -295,13 +303,17 @@ class allocator
//!Returns address of mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
BOOST_INTERPROCESS_NODISCARD
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
pointer address(reference value) const
{ return pointer(boost::container::dtl::addressof(value)); }
//!Returns address of non mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
BOOST_INTERPROCESS_NODISCARD
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
const_pointer address(const_reference value) const
{ return const_pointer(boost::container::dtl::addressof(value)); }
};

View File

@@ -288,10 +288,12 @@ class cached_adaptive_pool
//!Returns address of mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
pointer address(reference value) const;
//!Returns address of non mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
const_pointer address(const_reference value) const;
//! <b>Requires</b>: Uses-allocator construction of T with allocator argument
@@ -310,6 +312,7 @@ class cached_adaptive_pool
//!Returns maximum the number of objects the previously allocated memory
//!pointed by p can hold. This size only works for memory allocated with
//!allocate, allocation_command and allocate_many.
//!This function is deprecated and will be removed in the future
size_type size(const pointer &p) const;
pointer allocation_command(boost::interprocess::allocation_type command,
@@ -321,11 +324,13 @@ class cached_adaptive_pool
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
//!This function is deprecated and will be removed in the future
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
@@ -334,6 +339,7 @@ class cached_adaptive_pool
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function

View File

@@ -285,22 +285,22 @@ class cached_node_allocator
//!Returns maximum the number of objects the previously allocated memory
//!pointed by p can hold. This size only works for memory allocated with
//!allocate, allocation_command and allocate_many.
//!This function is deprecated and will be removed in the future
size_type size(const pointer &p) const;
pointer allocation_command(boost::interprocess::allocation_type command,
size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse);
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
//!the preferred and maximum number is
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
//!This function is deprecated and will be removed in the future
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
@@ -309,6 +309,7 @@ class cached_node_allocator
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function

View File

@@ -368,7 +368,9 @@ class array_allocation_impl
//!Returns maximum the number of objects the previously allocated memory
//!pointed by p can hold. This size only works for memory allocated with
//!allocate, allocation_command and allocate_many.
//!This function is deprecated and will be removed in the future
BOOST_INTERPROCESS_NODISCARD
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
size_type size(const pointer &p) const
{
return (size_type)this->derived()->get_segment_manager()->size(ipcdetail::to_raw_pointer(p))/sizeof(T);
@@ -391,20 +393,24 @@ class array_allocation_impl
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain)
//!This function is deprecated and will be removed in the future
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
void allocate_many(size_type elem_size, size_type num_elements, size_type alignment, multiallocation_chain &chain)
{
if(size_overflows<sizeof(T)>(elem_size)){
throw bad_alloc();
}
this->derived()->get_segment_manager()->allocate_many(elem_size*sizeof(T), num_elements, chain);
this->derived()->get_segment_manager()->allocate_many(elem_size*sizeof(T), num_elements, alignment, chain);
}
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain)
//!This function is deprecated and will be removed in the future
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
void allocate_many(const size_type *elem_sizes, size_type n_elements, size_type alignment, multiallocation_chain &chain)
{
this->derived()->get_segment_manager()->allocate_many(elem_sizes, n_elements, sizeof(T), chain);
this->derived()->get_segment_manager()->allocate_many(elem_sizes, n_elements, sizeof(T), alignment, chain);
}
//!Allocates many elements of size elem_size in a contiguous block
@@ -413,6 +419,8 @@ class array_allocation_impl
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
void deallocate_many(multiallocation_chain &chain)
{ this->derived()->get_segment_manager()->deallocate_many(chain); }
@@ -424,13 +432,17 @@ class array_allocation_impl
//!Returns address of mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
BOOST_INTERPROCESS_NODISCARD
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
pointer address(reference value) const
{ return pointer(boost::container::dtl::addressof(value)); }
//!Returns address of non mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
BOOST_INTERPROCESS_NODISCARD
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
const_pointer address(const_reference value) const
{ return const_pointer(boost::container::dtl::addressof(value)); }

View File

@@ -405,10 +405,12 @@ class node_allocator
//!Returns address of mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
pointer address(reference value) const;
//!Returns address of non mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
const_pointer address(const_reference value) const;
//! <b>Requires</b>: Uses-allocator construction of T with allocator argument
@@ -427,22 +429,22 @@ class node_allocator
//!Returns maximum the number of objects the previously allocated memory
//!pointed by p can hold. This size only works for memory allocated with
//!allocate, allocation_command and allocate_many.
//!This function is deprecated and will be removed in the future
size_type size(const pointer &p) const;
pointer allocation_command(boost::interprocess::allocation_type command,
size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse);
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
//!the preferred and maximum number is
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
//!This function is deprecated and will be removed in the future
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
@@ -451,6 +453,7 @@ class node_allocator
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function

View File

@@ -452,10 +452,12 @@ class private_adaptive_pool
//!Returns address of mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
pointer address(reference value) const;
//!Returns address of non mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
const_pointer address(const_reference value) const;
//! <b>Requires</b>: Uses-allocator construction of T with allocator argument
@@ -474,22 +476,22 @@ class private_adaptive_pool
//!Returns maximum the number of objects the previously allocated memory
//!pointed by p can hold. This size only works for memory allocated with
//!allocate, allocation_command and allocate_many.
//!This function is deprecated and will be removed in the future
size_type size(const pointer &p) const;
pointer allocation_command(boost::interprocess::allocation_type command,
size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse);
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
//!the preferred and maximum number is
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
//!This function is deprecated and will be removed in the future
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
@@ -498,6 +500,7 @@ class private_adaptive_pool
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function

View File

@@ -428,10 +428,12 @@ class private_node_allocator
//!Returns address of mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
pointer address(reference value) const;
//!Returns address of non mutable object.
//!Never throws
//!This function is deprecated and will be removed in the future
const_pointer address(const_reference value) const;
//! <b>Requires</b>: Uses-allocator construction of T with allocator argument
@@ -450,22 +452,22 @@ class private_node_allocator
//!Returns maximum the number of objects the previously allocated memory
//!pointed by p can hold. This size only works for memory allocated with
//!allocate, allocation_command and allocate_many.
//!This function is deprecated and will be removed in the future
size_type size(const pointer &p) const;
pointer allocation_command(boost::interprocess::allocation_type command,
size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse);
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
//!the preferred and maximum number is
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
//!This function is deprecated and will be removed in the future
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
@@ -474,6 +476,7 @@ class private_node_allocator
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
//!This function is deprecated and will be removed in the future
void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function