Skip to content

Commit 9d5a312

Browse files
committed
Deprecate "address", "size" and "(de)allocate_many" functions from allocators.
1 parent 9f1c4b2 commit 9d5a312

9 files changed

Lines changed: 67 additions & 21 deletions

File tree

doc/interprocess.qbk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6878,9 +6878,12 @@ thank them:
68786878
* Changed the interface of [link managed_memory_segment_advanced_features.managed_memory_segment_multiple_allocations Multiple allocation functions]
68796879
(still experimental and API/ABI unstable) to support alignment.
68806880

6881-
Added `BOOST_HEADER_DEPRECATED` to `<boost/interprocess/containers/*.hpp> headers. They were deprecated several releases ago, but this
6881+
* Added `BOOST_HEADER_DEPRECATED` to `<boost/interprocess/containers/*.hpp> headers. They were deprecated several releases ago, but this
68826882
message will annoy existing users to switch to Boost.Container headers.
68836883

6884+
* Deprecated `size()`, `allocate_many` and `deallocate_many`, `address` and `size` functions for allocators. They were not used in
6885+
Boost.Container and will be removed in the future.
6886+
68846887
* Fixed bugs:
68856888
* [@https://github.com/boostorg/interprocess/issues/242 GitHub #242 (['"Cygwin compatibility issues"])].
68866889
* [@https://github.com/boostorg/interprocess/issues/247 GitHub #247 (['"destruction of move-constructed map using private_adaptive_pool triggers Assertion"])].

include/boost/interprocess/allocators/adaptive_pool.hpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,12 @@ class adaptive_pool
425425

426426
//!Returns address of mutable object.
427427
//!Never throws
428+
//!This function is deprecated and will be removed in the future
428429
pointer address(reference value) const;
429430

430431
//!Returns address of non mutable object.
431432
//!Never throws
433+
//!This function is deprecated and will be removed in the future
432434
const_pointer address(const_reference value) const;
433435

434436
//! <b>Requires</b>: Uses-allocator construction of T with allocator argument
@@ -447,22 +449,22 @@ class adaptive_pool
447449
//!Returns maximum the number of objects the previously allocated memory
448450
//!pointed by p can hold. This size only works for memory allocated with
449451
//!allocate, allocation_command and allocate_many.
452+
//!This function is deprecated and will be removed in the future
450453
size_type size(const pointer &p) const;
451454

452-
pointer allocation_command(boost::interprocess::allocation_type command,
453-
size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse);
454-
455455
//!Allocates many elements of size elem_size in a contiguous block
456456
//!of memory. The minimum number to be allocated is min_elements,
457457
//!the preferred and maximum number is
458458
//!preferred_elements. The number of actually allocated elements is
459459
//!will be assigned to received_size. The elements must be deallocated
460-
//!with deallocate(...)
460+
//!with deallocate(...).
461+
//!This function is deprecated and will be removed in the future
461462
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
462463

463464
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
464465
//!contiguous block
465466
//!of memory. The elements must be deallocated
467+
//!This function is deprecated and will be removed in the future
466468
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
467469

468470
//!Allocates many elements of size elem_size in a contiguous block
@@ -471,6 +473,7 @@ class adaptive_pool
471473
//!preferred_elements. The number of actually allocated elements is
472474
//!will be assigned to received_size. The elements must be deallocated
473475
//!with deallocate(...)
476+
//!This function is deprecated and will be removed in the future
474477
void deallocate_many(multiallocation_chain &chain);
475478

476479
//!Allocates just one object. Memory allocated with this function

include/boost/interprocess/allocators/allocator.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ class allocator
215215
//!Returns maximum the number of objects the previously allocated memory
216216
//!pointed by p can hold. This size only works for memory allocated with
217217
//!allocate, allocation_command and allocate_many.
218+
//!This function is deprecated and will be removed in the future
218219
BOOST_INTERPROCESS_NODISCARD
220+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
219221
size_type size(const pointer &p) const
220222
{
221223
return (size_type)mp_mngr->size(ipcdetail::to_raw_pointer(p))/sizeof(T);
@@ -237,6 +239,8 @@ class allocator
237239
//!preferred_elements. The number of actually allocated elements is
238240
//!will be assigned to received_size. The elements must be deallocated
239241
//!with deallocate(...)
242+
//!This function is deprecated and will be removed in the future
243+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
240244
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain)
241245
{
242246
if(size_overflows<sizeof(T)>(elem_size)){
@@ -248,6 +252,8 @@ class allocator
248252
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
249253
//!contiguous block
250254
//!of memory. The elements must be deallocated
255+
//!This function is deprecated and will be removed in the future
256+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
251257
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain)
252258
{
253259
mp_mngr->allocate_many(elem_sizes, n_elements, sizeof(T), boost::container::dtl::alignment_of<T>::value, chain);
@@ -259,6 +265,8 @@ class allocator
259265
//!preferred_elements. The number of actually allocated elements is
260266
//!will be assigned to received_size. The elements must be deallocated
261267
//!with deallocate(...)
268+
//!This function is deprecated and will be removed in the future
269+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
262270
void deallocate_many(multiallocation_chain &chain)
263271
{ mp_mngr->deallocate_many(chain); }
264272

@@ -295,13 +303,17 @@ class allocator
295303

296304
//!Returns address of mutable object.
297305
//!Never throws
306+
//!This function is deprecated and will be removed in the future
298307
BOOST_INTERPROCESS_NODISCARD
308+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
299309
pointer address(reference value) const
300310
{ return pointer(boost::container::dtl::addressof(value)); }
301311

302312
//!Returns address of non mutable object.
303313
//!Never throws
314+
//!This function is deprecated and will be removed in the future
304315
BOOST_INTERPROCESS_NODISCARD
316+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
305317
const_pointer address(const_reference value) const
306318
{ return const_pointer(boost::container::dtl::addressof(value)); }
307319
};

include/boost/interprocess/allocators/cached_adaptive_pool.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,12 @@ class cached_adaptive_pool
288288

289289
//!Returns address of mutable object.
290290
//!Never throws
291+
//!This function is deprecated and will be removed in the future
291292
pointer address(reference value) const;
292293

293294
//!Returns address of non mutable object.
294295
//!Never throws
296+
//!This function is deprecated and will be removed in the future
295297
const_pointer address(const_reference value) const;
296298

297299
//! <b>Requires</b>: Uses-allocator construction of T with allocator argument
@@ -310,6 +312,7 @@ class cached_adaptive_pool
310312
//!Returns maximum the number of objects the previously allocated memory
311313
//!pointed by p can hold. This size only works for memory allocated with
312314
//!allocate, allocation_command and allocate_many.
315+
//!This function is deprecated and will be removed in the future
313316
size_type size(const pointer &p) const;
314317

315318
pointer allocation_command(boost::interprocess::allocation_type command,
@@ -321,11 +324,13 @@ class cached_adaptive_pool
321324
//!preferred_elements. The number of actually allocated elements is
322325
//!will be assigned to received_size. The elements must be deallocated
323326
//!with deallocate(...)
327+
//!This function is deprecated and will be removed in the future
324328
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
325329

326330
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
327331
//!contiguous block
328332
//!of memory. The elements must be deallocated
333+
//!This function is deprecated and will be removed in the future
329334
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
330335

331336
//!Allocates many elements of size elem_size in a contiguous block
@@ -334,6 +339,7 @@ class cached_adaptive_pool
334339
//!preferred_elements. The number of actually allocated elements is
335340
//!will be assigned to received_size. The elements must be deallocated
336341
//!with deallocate(...)
342+
//!This function is deprecated and will be removed in the future
337343
void deallocate_many(multiallocation_chain &chain);
338344

339345
//!Allocates just one object. Memory allocated with this function

include/boost/interprocess/allocators/cached_node_allocator.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,22 +285,22 @@ class cached_node_allocator
285285
//!Returns maximum the number of objects the previously allocated memory
286286
//!pointed by p can hold. This size only works for memory allocated with
287287
//!allocate, allocation_command and allocate_many.
288+
//!This function is deprecated and will be removed in the future
288289
size_type size(const pointer &p) const;
289290

290-
pointer allocation_command(boost::interprocess::allocation_type command,
291-
size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse);
292-
293291
//!Allocates many elements of size elem_size in a contiguous block
294292
//!of memory. The minimum number to be allocated is min_elements,
295293
//!the preferred and maximum number is
296294
//!preferred_elements. The number of actually allocated elements is
297295
//!will be assigned to received_size. The elements must be deallocated
298296
//!with deallocate(...)
297+
//!This function is deprecated and will be removed in the future
299298
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
300299

301300
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
302301
//!contiguous block
303302
//!of memory. The elements must be deallocated
303+
//!This function is deprecated and will be removed in the future
304304
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
305305

306306
//!Allocates many elements of size elem_size in a contiguous block
@@ -309,6 +309,7 @@ class cached_node_allocator
309309
//!preferred_elements. The number of actually allocated elements is
310310
//!will be assigned to received_size. The elements must be deallocated
311311
//!with deallocate(...)
312+
//!This function is deprecated and will be removed in the future
312313
void deallocate_many(multiallocation_chain &chain);
313314

314315
//!Allocates just one object. Memory allocated with this function

include/boost/interprocess/allocators/detail/allocator_common.hpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,9 @@ class array_allocation_impl
368368
//!Returns maximum the number of objects the previously allocated memory
369369
//!pointed by p can hold. This size only works for memory allocated with
370370
//!allocate, allocation_command and allocate_many.
371+
//!This function is deprecated and will be removed in the future
371372
BOOST_INTERPROCESS_NODISCARD
373+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
372374
size_type size(const pointer &p) const
373375
{
374376
return (size_type)this->derived()->get_segment_manager()->size(ipcdetail::to_raw_pointer(p))/sizeof(T);
@@ -391,20 +393,24 @@ class array_allocation_impl
391393
//!preferred_elements. The number of actually allocated elements is
392394
//!will be assigned to received_size. The elements must be deallocated
393395
//!with deallocate(...)
394-
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain)
396+
//!This function is deprecated and will be removed in the future
397+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
398+
void allocate_many(size_type elem_size, size_type num_elements, size_type alignment, multiallocation_chain &chain)
395399
{
396400
if(size_overflows<sizeof(T)>(elem_size)){
397401
throw bad_alloc();
398402
}
399-
this->derived()->get_segment_manager()->allocate_many(elem_size*sizeof(T), num_elements, chain);
403+
this->derived()->get_segment_manager()->allocate_many(elem_size*sizeof(T), num_elements, alignment, chain);
400404
}
401405

402406
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
403407
//!contiguous block
404408
//!of memory. The elements must be deallocated
405-
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain)
409+
//!This function is deprecated and will be removed in the future
410+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
411+
void allocate_many(const size_type *elem_sizes, size_type n_elements, size_type alignment, multiallocation_chain &chain)
406412
{
407-
this->derived()->get_segment_manager()->allocate_many(elem_sizes, n_elements, sizeof(T), chain);
413+
this->derived()->get_segment_manager()->allocate_many(elem_sizes, n_elements, sizeof(T), alignment, chain);
408414
}
409415

410416
//!Allocates many elements of size elem_size in a contiguous block
@@ -413,6 +419,8 @@ class array_allocation_impl
413419
//!preferred_elements. The number of actually allocated elements is
414420
//!will be assigned to received_size. The elements must be deallocated
415421
//!with deallocate(...)
422+
//!This function is deprecated and will be removed in the future
423+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
416424
void deallocate_many(multiallocation_chain &chain)
417425
{ this->derived()->get_segment_manager()->deallocate_many(chain); }
418426

@@ -424,13 +432,17 @@ class array_allocation_impl
424432

425433
//!Returns address of mutable object.
426434
//!Never throws
435+
//!This function is deprecated and will be removed in the future
427436
BOOST_INTERPROCESS_NODISCARD
437+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
428438
pointer address(reference value) const
429439
{ return pointer(boost::container::dtl::addressof(value)); }
430440

431441
//!Returns address of non mutable object.
432442
//!Never throws
443+
//!This function is deprecated and will be removed in the future
433444
BOOST_INTERPROCESS_NODISCARD
445+
BOOST_DEPRECATED("This function is deprecated and will be removed in the future")
434446
const_pointer address(const_reference value) const
435447
{ return const_pointer(boost::container::dtl::addressof(value)); }
436448

include/boost/interprocess/allocators/node_allocator.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,12 @@ class node_allocator
405405

406406
//!Returns address of mutable object.
407407
//!Never throws
408+
//!This function is deprecated and will be removed in the future
408409
pointer address(reference value) const;
409410

410411
//!Returns address of non mutable object.
411412
//!Never throws
413+
//!This function is deprecated and will be removed in the future
412414
const_pointer address(const_reference value) const;
413415

414416
//! <b>Requires</b>: Uses-allocator construction of T with allocator argument
@@ -427,22 +429,22 @@ class node_allocator
427429
//!Returns maximum the number of objects the previously allocated memory
428430
//!pointed by p can hold. This size only works for memory allocated with
429431
//!allocate, allocation_command and allocate_many.
432+
//!This function is deprecated and will be removed in the future
430433
size_type size(const pointer &p) const;
431434

432-
pointer allocation_command(boost::interprocess::allocation_type command,
433-
size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse);
434-
435435
//!Allocates many elements of size elem_size in a contiguous block
436436
//!of memory. The minimum number to be allocated is min_elements,
437437
//!the preferred and maximum number is
438438
//!preferred_elements. The number of actually allocated elements is
439439
//!will be assigned to received_size. The elements must be deallocated
440440
//!with deallocate(...)
441+
//!This function is deprecated and will be removed in the future
441442
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
442443

443444
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
444445
//!contiguous block
445446
//!of memory. The elements must be deallocated
447+
//!This function is deprecated and will be removed in the future
446448
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
447449

448450
//!Allocates many elements of size elem_size in a contiguous block
@@ -451,6 +453,7 @@ class node_allocator
451453
//!preferred_elements. The number of actually allocated elements is
452454
//!will be assigned to received_size. The elements must be deallocated
453455
//!with deallocate(...)
456+
//!This function is deprecated and will be removed in the future
454457
void deallocate_many(multiallocation_chain &chain);
455458

456459
//!Allocates just one object. Memory allocated with this function

include/boost/interprocess/allocators/private_adaptive_pool.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,12 @@ class private_adaptive_pool
452452

453453
//!Returns address of mutable object.
454454
//!Never throws
455+
//!This function is deprecated and will be removed in the future
455456
pointer address(reference value) const;
456457

457458
//!Returns address of non mutable object.
458459
//!Never throws
460+
//!This function is deprecated and will be removed in the future
459461
const_pointer address(const_reference value) const;
460462

461463
//! <b>Requires</b>: Uses-allocator construction of T with allocator argument
@@ -474,22 +476,22 @@ class private_adaptive_pool
474476
//!Returns maximum the number of objects the previously allocated memory
475477
//!pointed by p can hold. This size only works for memory allocated with
476478
//!allocate, allocation_command and allocate_many.
479+
//!This function is deprecated and will be removed in the future
477480
size_type size(const pointer &p) const;
478481

479-
pointer allocation_command(boost::interprocess::allocation_type command,
480-
size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse);
481-
482482
//!Allocates many elements of size elem_size in a contiguous block
483483
//!of memory. The minimum number to be allocated is min_elements,
484484
//!the preferred and maximum number is
485485
//!preferred_elements. The number of actually allocated elements is
486486
//!will be assigned to received_size. The elements must be deallocated
487487
//!with deallocate(...)
488+
//!This function is deprecated and will be removed in the future
488489
void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
489490

490491
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
491492
//!contiguous block
492493
//!of memory. The elements must be deallocated
494+
//!This function is deprecated and will be removed in the future
493495
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
494496

495497
//!Allocates many elements of size elem_size in a contiguous block
@@ -498,6 +500,7 @@ class private_adaptive_pool
498500
//!preferred_elements. The number of actually allocated elements is
499501
//!will be assigned to received_size. The elements must be deallocated
500502
//!with deallocate(...)
503+
//!This function is deprecated and will be removed in the future
501504
void deallocate_many(multiallocation_chain &chain);
502505

503506
//!Allocates just one object. Memory allocated with this function

0 commit comments

Comments
 (0)