@@ -76,18 +76,18 @@ ipc::buff_t make_cache(T &data, std::size_t size) {
76
76
}
77
77
78
78
acc_t *cc_acc (std::string const &pref) {
79
- static ipc::unordered_map<std::string, ipc::shm::handle> handles;
79
+ static auto *phs = new ipc::unordered_map<std::string, ipc::shm::handle>; // no delete
80
80
static std::mutex lock;
81
81
std::lock_guard<std::mutex> guard {lock};
82
- auto it = handles. find (pref);
83
- if (it == handles. end ()) {
82
+ auto it = phs-> find (pref);
83
+ if (it == phs-> end ()) {
84
84
std::string shm_name {ipc::make_prefix (pref, " CA_CONN__" )};
85
85
ipc::shm::handle h;
86
86
if (!h.acquire (shm_name.c_str (), sizeof (acc_t ))) {
87
87
ipc::error (" [cc_acc] acquire failed: %s\n " , shm_name.c_str ());
88
88
return nullptr ;
89
89
}
90
- it = handles. emplace (pref, std::move (h)).first ;
90
+ it = phs-> emplace (pref, std::move (h)).first ;
91
91
}
92
92
return static_cast <acc_t *>(it->second .get ());
93
93
}
@@ -248,8 +248,8 @@ auto& chunk_storages() {
248
248
};
249
249
using deleter_t = void (*)(chunk_handle_t *);
250
250
using chunk_handle_ptr_t = std::unique_ptr<chunk_handle_t , deleter_t >;
251
- static ipc::map<std::size_t , chunk_handle_ptr_t > chunk_hs;
252
- return chunk_hs;
251
+ static auto *chunk_hs = new ipc::map<std::size_t , chunk_handle_ptr_t >; // no delete
252
+ return * chunk_hs;
253
253
}
254
254
255
255
chunk_info_t *chunk_storage_info (conn_info_head *inf, std::size_t chunk_size) {
0 commit comments