625 Commits

Author SHA1 Message Date
木头云
eede00165e 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-01 09:24:58 +00:00
mutouyun
bb3c6eb534 Replace custom hash struct with std::hash in unordered_map definition 2025-05-24 15:14:30 +08:00
mutouyun
70121091d6 Fix the issue caused by inconsistent lifecycle of the global IPC object. 2025-05-06 17:59:03 +08:00
mutouyun
32c2be29a9 Refactoring the generic memory allocator 2025-03-09 18:02:51 +08:00
mutouyun
2d38a6a6e7 Reimplement the allocator required for the container type with $new 2025-03-09 18:02:51 +08:00
mutouyun
831225f763 Use $new instead of alloc 2025-03-09 18:02:51 +08:00
mutouyun
db109165f3 Simplify the implementation of memory allocation management 2025-03-09 18:02:51 +08:00
mutouyun
180920968f The memory allocator supports runtime dynamic size memory allocation 2025-03-09 18:02:51 +08:00
mutouyun
ea0a3a4bf6 libipc/memory/resource.h => libipc/mem/resource.h 2025-03-09 18:02:51 +08:00
mutouyun
89e9f87f36 Add $new 2025-03-09 18:02:51 +08:00
mutouyun
edc1e80585 Add block_pool 2025-03-09 18:02:51 +08:00
mutouyun
3571fa58c8 Adjust the allocator name 2025-03-09 18:02:51 +08:00
mutouyun
99272a452a Simplify verify_args function to fix error C3249 2025-03-09 18:02:51 +08:00
mutouyun
86d9d868c8 Fix fmt function to handle null pointers and return empty string 2025-03-09 18:02:51 +08:00
木头云
00162b96b9 Update c-cpp.yml 2025-03-09 18:02:51 +08:00
mutouyun
87edc6fab1 Fix fmt function to handle empty strings and update make_prefix template parameters 2025-03-09 18:02:51 +08:00
mutouyun
70a1f68f01 Optimize memory_resource & add monotonic_buffer_resource 2025-03-09 18:02:51 +08:00
mutouyun
b8d01ddf68 Add intrusive_stack 2025-03-09 18:02:51 +08:00
mutouyun
40eaab7310 Add allocator and rewrite allocator_wrapper 2025-03-09 18:02:51 +08:00
mutouyun
8c34d5d4bc Optimized partial implementation using fmt 2025-03-09 18:02:51 +08:00
mutouyun
48d4d6111d Start refactoring memory management, adding memory_resource 2025-03-09 18:02:51 +08:00
mutouyun
033f22ae8f Update platform-specific feature macros to new interfaces in imp 2025-03-09 18:02:51 +08:00
mutouyun
85bf8263fb Add system 2025-03-09 18:02:51 +08:00
mutouyun
6db5845a45 Add result 2025-03-09 18:02:51 +08:00
mutouyun
6c068f7ba4 IPC_EXPORT => LIBIPC_EXPORT 2025-03-09 18:02:51 +08:00
mutouyun
d2ba9dce52 Add log 2025-03-09 18:02:51 +08:00
mutouyun
72ec8ee42f Add error 2025-03-09 18:02:51 +08:00
mutouyun
e30ab84ccc Added fmt support for byte 2025-03-09 18:02:51 +08:00
mutouyun
e333bc754e Add fmt 2025-03-09 18:02:50 +08:00
mutouyun
a2d82ec6f0 Add codecvt 2025-03-09 18:02:50 +08:00
mutouyun
54f05e9536 libimp => libipc 2025-03-09 18:02:50 +08:00
mutouyun
e5546179e2 Add nameof & scope_exit 2025-03-09 18:02:50 +08:00
mutouyun
e5a56f02f1 Move the export.h file to the imp directory 2025-03-09 18:02:50 +08:00
mutouyun
ed8f9d06a6 Add expected 2025-03-09 18:02:50 +08:00
mutouyun
67776aea65 Add imp for subsequent refactoring 2025-03-09 18:02:50 +08:00
木头云
f3bf137668
Merge pull request #139 from aengusjiang/master
acquire 仅open不存在的shm不应该打印错误日志
2025-03-08 15:52:35 +08:00
Aengus.Jiang
7bb5f2e611 Merge branch 'master' of https://github.com/aengusjiang/cpp-ipc 2025-03-07 12:34:38 +08:00
Aengus.Jiang
06d4aec320 posix shm open 失败时如果文件不存在打印log #2 修改逻辑错误 2025-03-07 12:33:42 +08:00
Aengus.Jiang
5c36b1264f posix shm open 失败时如果文件不存在打印log 2025-03-07 11:57:31 +08:00
Aengus.Jiang
d69093462a open的时候不存在共享内存,则返回false,没有必要报错 2025-03-07 11:36:57 +08:00
木头云
df09c22738
Update README.md 2025-02-09 17:00:48 +08:00
mutouyun
2673453e66 Try to fix permission issues under linux 2024-12-01 21:06:06 +08:00
mutouyun
84bb801b6e Try to fix a communication problem caused by different permissions under linux 2024-12-01 19:53:40 +08:00
mutouyun
5e5b347636 Complete the implementation of the clean interface and add unit tests 2024-12-01 19:06:50 +08:00
mutouyun
28fdf17279 Added cleanup interfaces for ipc chan 2024-12-01 17:49:34 +08:00
mutouyun
17dcde92bf Added clear_storage for quieue 2024-12-01 17:49:34 +08:00
mutouyun
ab90437e44 Added a cleanup interface for waiter. 2024-12-01 17:49:34 +08:00
mutouyun
acea9d74da Fix ut 2024-11-17 17:51:18 +08:00
mutouyun
e1f377d7f6 Added a cleanup interface for the synchronization facilities 2024-11-17 17:39:03 +08:00
mutouyun
29678f1d41 Added a cleanup interface for queue 2024-11-17 17:36:09 +08:00