14 Commits

Author SHA1 Message Date
木头云
cf444e5309 fix(container_allocator): Fix MSVC compilation by correcting allocator semantics
ROOT CAUSE:
The allocate() function was incorrectly constructing objects during memory
allocation, violating C++ allocator requirements. MSVC's std::_Tree_node has
a deleted default constructor, causing compilation failure.

CHANGES:
- container_allocator::allocate() now only allocates raw memory without
  constructing objects (removed mem::$new and ipc::construct calls)
- container_allocator::deallocate() now only frees memory without
  destroying objects (removed mem::$delete and ipc::destroy_n calls)

WHY THIS FIXES THE ISSUE:
C++ allocator semantics require strict separation:
  * allocate()   -> raw memory allocation only
  * construct()  -> object construction with proper arguments
  * destroy()    -> object destruction
  * deallocate() -> memory deallocation only

Standard containers (like std::map) call construct() with proper arguments
(key, value) to initialize nodes, not allocate(). Since std::_Tree_node in
MSVC has no default constructor (= delete), attempting to construct it
without arguments always fails.

Fixes MSVC 2017 compilation error:
  error C2280: 'std::_Tree_node<...>::_Tree_node(void)':
  attempting to reference a deleted function
2025-12-03 08:13:44 +00:00
mutouyun
a1f858f560 Refactoring the generic memory allocator 2025-12-03 08:13:44 +00:00
mutouyun
10c0d14de6 Reimplement the allocator required for the container type with $new 2025-12-03 08:13:44 +00:00
mutouyun
4e70d6c60b Use $new instead of alloc 2025-12-03 08:13:44 +00:00
mutouyun
5db7e70cdd Simplify the implementation of memory allocation management 2025-12-03 08:13:00 +00:00
mutouyun
8b384ba5f2 The memory allocator supports runtime dynamic size memory allocation 2025-12-03 08:13:00 +00:00
mutouyun
e3c1755b9a Add $new 2025-12-03 08:11:57 +00:00
mutouyun
0b33859d33 Add block_pool 2025-12-03 08:11:57 +00:00
mutouyun
dd8307e81a Adjust the allocator name 2025-12-03 08:11:57 +00:00
mutouyun
e7a8005f58 Optimize memory_resource & add monotonic_buffer_resource 2025-12-03 08:11:57 +00:00
mutouyun
d260897b16 Add allocator and rewrite allocator_wrapper 2025-12-03 08:11:57 +00:00
mutouyun
a4361d2b97 Start refactoring memory management, adding memory_resource 2025-12-03 08:11:57 +00:00
mutouyun
09a304161f IPC_EXPORT => LIBIPC_EXPORT 2025-12-03 08:11:24 +00:00
mutouyun
8098c8e37a Add imp for subsequent refactoring 2025-12-03 08:08:03 +00:00