Chromium custom build network service crashed - c++

I have rebranded Chromium project to create my own browser. I have changed the chromium icon and name. I tried to chagne the chrome url scheme (chrome://settings/* for example) to replace it with the app new name. After changing all chrome urls, I get Network Service Crash error. I was wondering if anyone could help me.
[91363:20227:0627/222457.703517:FATAL:origin.cc(291)] Check failed: tuple_.IsValid().
0 libbase.dylib 0x000000010db4037f base::debug::CollectStackTrace(void**, unsigned long) + 31
1 libbase.dylib 0x000000010d7fdc88 base::debug::StackTrace::StackTrace(unsigned long) + 72
2 libbase.dylib 0x000000010d7fdd0d base::debug::StackTrace::StackTrace(unsigned long) + 29
3 libbase.dylib 0x000000010d7fdce5 base::debug::StackTrace::StackTrace() + 37
4 libbase.dylib 0x000000010d85e293 logging::LogMessage::~LogMessage() + 179
5 libbase.dylib 0x000000010d85f315 logging::LogMessage::~LogMessage() + 21
6 libbase.dylib 0x000000010d85f339 logging::LogMessage::~LogMessage() + 25
7 libbase.dylib 0x000000010d7b592b logging::CheckError::~CheckError() + 43
8 libbase.dylib 0x000000010d7b5405 logging::CheckError::~CheckError() + 21
9 liburl.dylib 0x000000010bdf314e url::Origin::Origin(url::SchemeHostPort) + 286
10 liburl.dylib 0x000000010bdf0f85 url::Origin::Origin(url::SchemeHostPort) + 21
11 liburl.dylib 0x000000010bdf3fc0 url::Origin::Deserialize(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char> > const&) + 784
12 libnet.dylib 0x00000001201b1ddb net::SchemefulSite::DeserializeWithNonce(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char> > const&) + 91
13 libnet.dylib 0x000000012019142d net::NetworkIsolationKey::FromValue(base::Value const&, net::NetworkIsolationKey*) + 349
14 libnet.dylib 0x000000012054e49c net::(anonymous namespace)::GetNetworkIsolationKeyFromDict(base::Value const&, bool, net::NetworkIsolationKey*) + 332
15 libnet.dylib 0x000000012054c8d7 net::HttpServerPropertiesManager::AddServerData(base::Value const&, net::HttpServerProperties::ServerInfoMap*, bool) + 231
16 libnet.dylib 0x000000012054b971 net::HttpServerPropertiesManager::ReadPrefs(std::__Cr::unique_ptr<net::HttpServerProperties::ServerInfoMap, std::__Cr::default_delete<net::HttpServerProperties::ServerInfoMap> >*, net::IPAddress*, std::__Cr::unique_ptr<base::LRUCache<net::HttpServerProperties::QuicServerInfoMapKey, std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char> >, std::__Cr::less<net::HttpServerProperties::QuicServerInfoMapKey> >, std::__Cr::default_delete<base::LRUCache<net::HttpServerProperties::QuicServerInfoMapKey, std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char> >, std::__Cr::less<net::HttpServerProperties::QuicServerInfoMapKey> > > >*, std::__Cr::unique_ptr<std::__Cr::list<std::__Cr::pair<net::BrokenAlternativeService, base::TimeTicks>, std::__Cr::allocator<std::__Cr::pair<net::BrokenAlternativeService, base::TimeTicks> > >, std::__Cr::default_delete<std::__Cr::list<std::__Cr::pair<net::BrokenAlternativeService, base::TimeTicks>, std::__Cr::allocator<std::__Cr::pair<net::BrokenAlternativeService, base::TimeTicks> > > > >*, std::__Cr::unique_ptr<net::RecentlyBrokenAlternativeServices, std::__Cr::default_delete<net::RecentlyBrokenAlternativeServices> >*) + 1409
17 libnet.dylib 0x000000012054b121 net::HttpServerPropertiesManager::OnHttpServerPropertiesLoaded() + 241
18 libnet.dylib 0x0000000120556edf void base::internal::FunctorTraits<void (net::HttpServerPropertiesManager::*)(), void>::Invoke<void (net::HttpServerPropertiesManager::*)(), base::WeakPtr<net::HttpServerPropertiesManager> >(void (net::HttpServerPropertiesManager::*)(), base::WeakPtr<net::HttpServerPropertiesManager>&&) + 127
19 libnet.dylib 0x0000000120556dc7 void base::internal::InvokeHelper<true, void>::MakeItSo<void (net::HttpServerPropertiesManager::*)(), base::WeakPtr<net::HttpServerPropertiesManager> >(void (net::HttpServerPropertiesManager::*&&)(), base::WeakPtr<net::HttpServerPropertiesManager>&&) + 103
20 libnet.dylib 0x0000000120556d32 void base::internal::Invoker<base::internal::BindState<void (net::HttpServerPropertiesManager::*)(), base::WeakPtr<net::HttpServerPropertiesManager> >, void ()>::RunImpl<void (net::HttpServerPropertiesManager::*)(), std::__Cr::tuple<base::WeakPtr<net::HttpServerPropertiesManager> >, 0ul>(void (net::HttpServerPropertiesManager::*&&)(), std::__Cr::tuple<base::WeakPtr<net::HttpServerPropertiesManager> >&&, std::__Cr::integer_sequence<unsigned long, 0ul>) + 66
21 libnet.dylib 0x0000000120556c6c base::internal::Invoker<base::internal::BindState<void (net::HttpServerPropertiesManager::*)(), base::WeakPtr<net::HttpServerPropertiesManager> >, void ()>::RunOnce(base::internal::BindStateBase*) + 76
22 libnetwork_service.dylib 0x0000000143977b2f base::OnceCallback<void ()>::Run() && + 111
23 libnetwork_service.dylib 0x0000000143a1943b _ZZN7network32HttpServerPropertiesPrefDelegate15WaitForPrefLoadEN4base12OnceCallbackIFvvEEEENK3$_0clES4_b + 43
24 libnetwork_service.dylib 0x0000000143a193e1 _ZN4base8internal13FunctorTraitsIZN7network32HttpServerPropertiesPrefDelegate15WaitForPrefLoadENS_12OnceCallbackIFvvEEEE3$_0vE6InvokeIS7_JS6_bEEEvOT_DpOT0_ + 97
25 libnetwork_service.dylib 0x0000000143a19347 _ZN4base8internal12InvokeHelperILb0EvE8MakeItSoIZN7network32HttpServerPropertiesPrefDelegate15WaitForPrefLoadENS_12OnceCallbackIFvvEEEE3$_0JS8_bEEEvOT_DpOT0_ + 71
26 libnetwork_service.dylib 0x0000000143a192d7 _ZN4base8internal7InvokerINS0_9BindStateIZN7network32HttpServerPropertiesPrefDelegate15WaitForPrefLoadENS_12OnceCallbackIFvvEEEE3$_0JS7_EEEFvbEE7RunImplIS8_NSt4__Cr5tupleIJS7_EEEJLm0EEEEvOT_OT0_NSD_16integer_sequenceImJXspT1_EEEEOb + 87
27 libnetwork_service.dylib 0x0000000143a191e3 _ZN4base8internal7InvokerINS0_9BindStateIZN7network32HttpServerPropertiesPrefDelegate15WaitForPrefLoadENS_12OnceCallbackIFvvEEEE3$_0JS7_EEEFvbEE7RunOnceEPNS0_13BindStateBaseEb + 115
28 libprefs.dylib 0x000000011da8df70 base::OnceCallback<void (bool)>::Run(bool) && + 144
29 libprefs.dylib 0x000000011daa9082 PrefNotifierImpl::OnInitializationCompleted(bool) + 274
30 libprefs.dylib 0x000000011dac996d PrefValueStore::CheckInitializationCompleted() + 269
31 libprefs.dylib 0x000000011dac958a PrefValueStore::OnInitializationCompleted(PrefValueStore::PrefStoreType, bool) + 106
32 libprefs.dylib 0x000000011dac950c PrefValueStore::PrefStoreKeeper::OnInitializationCompleted(bool) + 60
33 libprefs.dylib 0x000000011da8e915 JsonPrefStore::FinalizeFileRead(bool, std::__Cr::unique_ptr<base::DictionaryValue, std::__Cr::default_delete<base::DictionaryValue> >, bool) + 1045
34 libprefs.dylib 0x000000011da8cb5b JsonPrefStore::OnFileRead(std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >) + 923
35 libprefs.dylib 0x000000011da930b2 void base::internal::FunctorTraits<void (JsonPrefStore::*)(std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >), void>::Invoke<void (JsonPrefStore::*)(std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >), base::WeakPtr<JsonPrefStore>, std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > >(void (JsonPrefStore::*)(std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >), base::WeakPtr<JsonPrefStore>&&, std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >&&) + 178
36 libprefs.dylib 0x000000011da92f5c void base::internal::InvokeHelper<true, void>::MakeItSo<void (JsonPrefStore::*)(std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >), base::WeakPtr<JsonPrefStore>, std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > >(void (JsonPrefStore::*&&)(std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >), base::WeakPtr<JsonPrefStore>&&, std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >&&) + 124
37 libprefs.dylib 0x000000011da92ea7 void base::internal::Invoker<base::internal::BindState<void (JsonPrefStore::*)(std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >), base::WeakPtr<JsonPrefStore> >, void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>::RunImpl<void (JsonPrefStore::*)(std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >), std::__Cr::tuple<base::WeakPtr<JsonPrefStore> >, 0ul>(void (JsonPrefStore::*&&)(std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >), std::__Cr::tuple<base::WeakPtr<JsonPrefStore> >&&, std::__Cr::integer_sequence<unsigned long, 0ul>, std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >&&) + 87
38 libprefs.dylib 0x000000011da92da1 base::internal::Invoker<base::internal::BindState<void (JsonPrefStore::*)(std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >), base::WeakPtr<JsonPrefStore> >, void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>::RunOnce(base::internal::BindStateBase*, std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >&&) + 97
39 libprefs.dylib 0x000000011da959a4 base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>::Run(std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >) && + 132
40 libprefs.dylib 0x000000011da93d3e void base::internal::ReplyAdapter<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > >(base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*) + 190
41 libprefs.dylib 0x000000011da95050 void base::internal::FunctorTraits<void (*)(base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*), void>::Invoke<void (*)(base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*), base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*>(void (*&&)(base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*), base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>&&, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*&&) + 96
42 libprefs.dylib 0x000000011da94f37 void base::internal::InvokeHelper<false, void>::MakeItSo<void (*)(base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*), base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*>(void (*&&)(base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*), base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>&&, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*&&) + 71
43 libprefs.dylib 0x000000011da94ea6 void base::internal::Invoker<base::internal::BindState<void (*)(base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*), base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, base::internal::OwnedWrapper<std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >, std::__Cr::default_delete<std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > > > > >, void ()>::RunImpl<void (*)(base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*), std::__Cr::tuple<base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, base::internal::OwnedWrapper<std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >, std::__Cr::default_delete<std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > > > > >, 0ul, 1ul>(void (*&&)(base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*), std::__Cr::tuple<base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, base::internal::OwnedWrapper<std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >, std::__Cr::default_delete<std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > > > > >&&, std::__Cr::integer_sequence<unsigned long, 0ul, 1ul>) + 118
44 libprefs.dylib 0x000000011da94d9c base::internal::Invoker<base::internal::BindState<void (*)(base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >*), base::OnceCallback<void (std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >)>, base::internal::OwnedWrapper<std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > >, std::__Cr::default_delete<std::__Cr::unique_ptr<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> >, std::__Cr::default_delete<std::__Cr::unique_ptr<JsonPrefStore::ReadResult, std::__Cr::default_delete<JsonPrefStore::ReadResult> > > > > > >, void ()>::RunOnce(base::internal::BindStateBase*) + 76
45 libbase.dylib 0x000000010d7a7a2f base::OnceCallback<void ()>::Run() && + 111
46 libbase.dylib 0x000000010dace616 base::(anonymous namespace)::PostTaskAndReplyRelay::RunReply(base::(anonymous namespace)::PostTaskAndReplyRelay) + 262
47 libbase.dylib 0x000000010dacf3bd void base::internal::FunctorTraits<void (*)(base::(anonymous namespace)::PostTaskAndReplyRelay), void>::Invoke<void (*)(base::(anonymous namespace)::PostTaskAndReplyRelay), base::(anonymous namespace)::PostTaskAndReplyRelay>(void (*&&)(base::(anonymous namespace)::PostTaskAndReplyRelay), base::(anonymous namespace)::PostTaskAndReplyRelay&&) + 77
48 libbase.dylib 0x000000010dacf302 void base::internal::InvokeHelper<false, void>::MakeItSo<void (*)(base::(anonymous namespace)::PostTaskAndReplyRelay), base::(anonymous namespace)::PostTaskAndReplyRelay>(void (*&&)(base::(anonymous namespace)::PostTaskAndReplyRelay), base::(anonymous namespace)::PostTaskAndReplyRelay&&) + 50
49 libbase.dylib 0x000000010dacf2a2 void base::internal::Invoker<base::internal::BindState<void (*)(base::(anonymous namespace)::PostTaskAndReplyRelay), base::(anonymous namespace)::PostTaskAndReplyRelay>, void ()>::RunImpl<void (*)(base::(anonymous namespace)::PostTaskAndReplyRelay), std::__Cr::tuple<base::(anonymous namespace)::PostTaskAndReplyRelay>, 0ul>(void (*&&)(base::(anonymous namespace)::PostTaskAndReplyRelay), std::__Cr::tuple<base::(anonymous namespace)::PostTaskAndReplyRelay>&&, std::__Cr::integer_sequence<unsigned long, 0ul>) + 66
50 libbase.dylib 0x000000010dacf1dc base::internal::Invoker<base::internal::BindState<void (*)(base::(anonymous namespace)::PostTaskAndReplyRelay), base::(anonymous namespace)::PostTaskAndReplyRelay>, void ()>::RunOnce(base::internal::BindStateBase*) + 76
51 libbase.dylib 0x000000010d7a7a2f base::OnceCallback<void ()>::Run() && + 111
52 libbase.dylib 0x000000010d9f02aa base::TaskAnnotator::RunTaskImpl(base::PendingTask&) + 426
53 libbase.dylib 0x000000010da59fde _ZN4base13TaskAnnotator7RunTaskIJZNS_16sequence_manager8internal35ThreadControllerWithMessagePumpImpl10DoWorkImplEPNS2_7LazyNowEE3$_0EEEvN8perfetto12StaticStringERNS_11PendingTaskEDpOT_ + 126
54 libbase.dylib 0x000000010da59d48 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::sequence_manager::LazyNow*) + 1576
55 libbase.dylib 0x000000010da59412 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() + 274
56 libbase.dylib 0x000000010da59f20 non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() + 32
57 libbase.dylib 0x000000010dbd4492 base::MessagePumpKqueue::Run(base::MessagePump::Delegate*) + 226
58 libbase.dylib 0x000000010da5a599 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) + 633
59 libbase.dylib 0x000000010d969653 base::RunLoop::Run(base::Location const&) + 755
60 libbase.dylib 0x000000010dae0241 base::Thread::Run(base::RunLoop*) + 321
61 libcontent.dylib 0x0000000194d8a11a content::(anonymous namespace)::ChildIOThread::Run(base::RunLoop*) + 122
62 libbase.dylib 0x000000010dae07d8 base::Thread::ThreadMain() + 1320
63 libbase.dylib 0x000000010db6b682 base::(anonymous namespace)::ThreadFunc(void*) + 226
64 libsystem_pthread.dylib 0x00007ff80ef7f4e1 _pthread_start + 125
65 libsystem_pthread.dylib 0x00007ff80ef7af6b thread_start + 15
Task trace:
0 libprefs.dylib 0x000000011da8ce76 JsonPrefStore::ReadPrefsAsync(PersistentPrefStore::ReadErrorDelegate*) + 150
1 libprefs.dylib 0x000000011da8ce76 JsonPrefStore::ReadPrefsAsync(PersistentPrefStore::ReadErrorDelegate*) + 150

Related

SwiftUI Crash in AG::LayoutDescriptor::Builder::Emitter

I'm trying to find the problem that causes this crash only on iOS 13.2 - 13.3 devices:
3
AttributeGraph
AG::precondition_failure(char const*, ...) + 192
4
AttributeGraph
AG::LayoutDescriptor::Builder::Emitter<AG::vector<unsigned char, 512ul> >::operator()(AG::LayoutDescriptor::Builder::EqualsItem const&) + 214
5
AttributeGraph
AG::LayoutDescriptor::Builder::Emitter<AG::vector<unsigned char, 512ul> >::operator()(AG::LayoutDescriptor::Builder::EqualsItem const&) + 124
6
AttributeGraph
AG::LayoutDescriptor::Builder::commit(AG::swift::metadata const*) + 152
7
AttributeGraph
AG::LayoutDescriptor::make_layout(AG::swift::metadata const*, AGComparisonMode, AG::LayoutDescriptor::HeapMode) + 320
8
AttributeGraph
AG::(anonymous namespace)::LayoutCache::drain_queue(void*) + 152
Does anyone know what might cause this issue?
Update: I fixed this issue by conforming the rootView to Equatable protocol.

Why is this recursive subset sum algorithm causing a pointer allocation error?

Alright, so here's my subset sum algorithm implementation:
std::vector<Key> Brute::subset_sum(const std::vector<Key>& Table, Key& target, const std::vector<Key>& solution) {
Key sum = Key();
for (std::vector<Key>::const_iterator it = solution.begin(); it != solution.end(); it++) {
sum += *it;
}
if (sum == target) {
return solution;
}
if (target < sum) {
return std::vector<Key>();
}
Key key;
for (std::vector<Key>::const_iterator it = Table.begin(); it != Table.end(); it++) {
key = *it;
std::vector<Key> remaining;
for (std::vector<Key>::const_iterator jt = it; jt != Table.end(); jt++) {
if (jt == it) {
continue;
}
remaining.push_back(*it);
}
std::vector<Key> sol = solution;
sol.push_back(key);
subset_sum(remaining, target, sol);
}
}
Each Key has a numerical value and the required comparison and addition operators have been overloaded.
Upon running this through lldb, I get the following output:
(lldb)
brute(1465,0x7fffae14d3c0) malloc: *** error for object 0x7fff5fbff6b0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Process 1465 stopped
* thread #1: tid = 0x9ee7, 0x00007fffa5307d42 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00007fffa5307d42 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0x7fffa5307d42 <+10>: jae 0x7fffa5307d4c ; <+20>
0x7fffa5307d44 <+12>: movq %rax, %rdi
0x7fffa5307d47 <+15>: jmp 0x7fffa5300caf ; cerror_nocancel
0x7fffa5307d4c <+20>: retq
Here's the backtrace:
(lldb) bt
* thread #1: tid = 0x9ee7, 0x00007fffa5307d42 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x00007fffa5307d42 libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fffa53f55bf libsystem_pthread.dylib`pthread_kill + 90
frame #2: 0x00007fffa526d420 libsystem_c.dylib`abort + 129
frame #3: 0x00007fffa535cfe7 libsystem_malloc.dylib`free + 530
frame #4: 0x00000001000022a6 brute`Brute::subset_sum(std::__1::vector<Key, std::__1::allocator<Key> > const&, Key&, std::__1::vector<Key, std::__1::allocator<Key> > const&) [inlined] std::__1::__deallocate(__ptr=<unavailable>) + 822 at new:177 [opt]
frame #5: 0x00000001000022a1 brute`Brute::subset_sum(std::__1::vector<Key, std::__1::allocator<Key> > const&, Key&, std::__1::vector<Key, std::__1::allocator<Key> > const&) [inlined] std::__1::allocator<Key>::deallocate(__p=<unavailable>) at memory:1731 [opt]
frame #6: 0x00000001000022a1 brute`Brute::subset_sum(std::__1::vector<Key, std::__1::allocator<Key> > const&, Key&, std::__1::vector<Key, std::__1::allocator<Key> > const&) [inlined] std::__1::allocator_traits<std::__1::allocator<Key> >::deallocate(__p=<unavailable>) at memory:1496 [opt]
frame #7: 0x00000001000022a1 brute`Brute::subset_sum(std::__1::vector<Key, std::__1::allocator<Key> > const&, Key&, std::__1::vector<Key, std::__1::allocator<Key> > const&) [inlined] std::__1::__vector_base<Key, std::__1::allocator<Key> >::~__vector_base() + 21 at vector:452 [opt]
frame #8: 0x000000010000228c brute`Brute::subset_sum(std::__1::vector<Key, std::__1::allocator<Key> > const&, Key&, std::__1::vector<Key, std::__1::allocator<Key> > const&) [inlined] std::__1::vector<Key, std::__1::allocator<Key> >::~vector() at vector:457 [opt]
frame #9: 0x000000010000228c brute`Brute::subset_sum(std::__1::vector<Key, std::__1::allocator<Key> > const&, Key&, std::__1::vector<Key, std::__1::allocator<Key> > const&) [inlined] std::__1::vector<Key, std::__1::allocator<Key> >::~vector() at vector:457 [opt]
frame #10: 0x000000010000228c brute`Brute::subset_sum(this=0x0000000100400000, Table=<unavailable>, target=<unavailable>, solution=size=1) + 796 at brute.cpp:56 [opt]
frame #11: 0x0000000100002269 brute`Brute::subset_sum(this=0x0000000100400000, Table=<unavailable>, target=<unavailable>, solution=size=0) + 761 at brute.cpp:56 [opt]
frame #12: 0x0000000100002884 brute`main [inlined] Brute::decrypt(this=0x0000000100400000) + 56 at brute.cpp:27 [opt]
frame #13: 0x000000010000284c brute`main(argc=<unavailable>, argv=<unavailable>) + 44 at brute.cpp:97 [opt]
frame #14: 0x00007fffa51d9235 libdyld.dylib`start + 1
frame #15: 0x00007fffa51d9235 libdyld.dylib`start + 1
It's been a while since I coded in C++, so I'd appreciate if someone familiar with the language could point the fault in my approach here.
Your function does not have a return statement at the end. If execution reaches the end of the function, your program will be subject to undefined behavior.
I am not able to suggest a solution since I don't clearly understand the logic in your function.

Interpreting profiler log for STL based code

I did a generalization a an algorithm implementation.
Now, the new implementation runs more than 100 times slower than the old one.
My guess is that the source unnecessary use of inefficiency is implicit copy constructors that I somehow introduced. I tried to profile the code, but I get a lot of data that I do not understand. Do I really need to know STL internals to be able to profile STL based code?
Snippet of the flat profile:
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
5.22 0.52 0.52 9092637 0.00 0.00 std::_List_base<unsigned int, std::allocator<unsigned int> >::_M_clear()
4.11 0.93 0.41 25264275 0.00 0.00 std::_List_node<unsigned int>* std::list<unsigned int, std::allocator<unsigned int> >::_M_create_node<unsigned int const&>(unsigned int const&)
3.66 1.29 0.36 9084123 0.00 0.00 void std::list<unsigned int, std::allocator<unsigned int> >::_M_initialize_dispatch<std::_List_const_iterator<unsigned int> >(std::_List_const_iterator<unsigned int>, std::_List_const_iterator<unsigned int>, std::__false_type)
3.11 1.60 0.31 25264275 0.00 0.00 std::_List_node<unsigned int>::_List_node<unsigned int const&>(unsigned int const&)
2.61 1.86 0.26 101061221 0.00 0.00 unsigned int const& std::forward<unsigned int const&>(std::remove_reference<unsigned int const&>::type&)
2.56 2.12 0.26 25264275 0.00 0.00 std::list<unsigned int, std::allocator<unsigned int> >::push_back(unsigned int const&)
2.51 2.37 0.25 25264275 0.00 0.00 void std::list<unsigned int, std::allocator<unsigned int> >::_M_insert<unsigned int const&>(std::_List_iterator<unsigned int>, unsigned int const&)
2.41 2.61 0.24 9080201 0.00 0.00 std::vector<short, std::allocator<short> >::vector(std::vector<short, std::allocator<short> > const&)
2.21 2.83 0.22 9082855 0.00 0.00 std::list<unsigned int, std::allocator<unsigned int> >::list(std::list<unsigned int, std::allocator<unsigned int> > const&)
2.16 3.04 0.21 25264275 0.00 0.00 void __gnu_cxx::new_allocator<std::_List_node<unsigned int> >::construct<unsigned int const&>(std::_List_node<unsigned int>*, unsigned int const&)
2.01 3.25 0.20 25270362 0.00 0.00 __gnu_cxx::new_allocator<std::_List_node<unsigned int> >::allocate(unsigned int, void const*)
1.76 3.42 0.17 9091186 0.00 0.00 std::vector<short, std::allocator<short> >::size() const
1.71 3.59 0.17 50552766 0.00 0.00 std::_List_base<unsigned int, std::allocator<unsigned int> >::_M_get_Node_allocator()
1.71 3.76 0.17 25270362 0.00 0.00 std::_List_base<unsigned int, std::allocator<unsigned int> >::_M_put_node(std::_List_node<unsigned int>*)
1.65 3.92 0.17 9084123 0.00 0.00 std::_List_base<unsigned int, std::allocator<unsigned int> >::_List_base(std::allocator<unsigned int> const&)
1.55 4.08 0.15 9055760 0.00 0.00 bool __gnu_cxx::operator!=<std::vector<short, std::allocator<short> > const*, std::vector<std::vector<short, std::allocator<short> >, std::allocator<std::vector<short, std::allocator<short> > > > >(__gnu_cxx::__normal_iterator<std::vector<short, std::allocator<short> > const*, std::vector<std::vector<short, std::allocator<short> >, std::allocator<std::vector<short, std::allocator<short> > > > > const&, __gnu_cxx::__normal_iterator<std::vector<short, std::allocator<short> > const*, std::vector<std::vector<short, std::allocator<short> >, std::allocator<std::vector<short, std::allocator<short> > > > > const&)
1.50 4.23 0.15 25249466 0.00 0.00 std::_List_const_iterator<unsigned int>::operator++()
1.45 4.38 0.14 9084596 0.00 0.00 std::_Vector_base<short, std::allocator<short> >::~_Vector_base()
1.45 4.52 0.14 9051640 0.00 0.00 void std::_Construct<std::list<unsigned int, std::allocator<unsigned int> >, std::list<unsigned int, std::allocator<unsigned int> > const&>(std::list<unsigned int, std::allocator<unsigned int> >*, std::list<unsigned int, std::allocator<unsigned int> > const&)
1.40 4.66 0.14 4120 0.00 0.00 std::list<unsigned int, std::allocator<unsigned int> >* std::__uninitialized_copy<false>::__uninit_copy<__gnu_cxx::__normal_iterator<std::list<unsigned int, std::allocator<unsigned int> > const*, std::vector<std::list<unsigned int, std::allocator<unsigned int> >, std::allocator<std::list<unsigned int, std::allocator<unsigned int> > > > >, std::list<unsigned int, std::allocator<unsigned int> >*>(__gnu_cxx::__normal_iterator<std::list<unsigned int, std::allocator<unsigned int> > const*, std::vector<std::list<unsigned int, std::allocator<unsigned int> >, std::allocator<std::list<unsigned int, std::allocator<unsigned int> > > > >, __gnu_cxx::__normal_iterator<std::list<unsigned int, std::allocator<unsigned int> > const*, std::vector<std::list<unsigned int, std::allocator<unsigned int> >, std::allocator<std::list<unsigned int, std::allocator<unsigned int> > > > >, std::list<unsigned int, std::allocator<unsigned int> >*)
1.40 4.80 0.14 4120 0.00 0.00 std::vector<short, std::allocator<short> >* std::__uninitialized_copy<false>::__uninit_copy<__gnu_cxx::__normal_iterator<std::vector<short, std::allocator<short> > const*, std::vector<std::vector<short, std::allocator<short> >, std::allocator<std::vector<short, std::allocator<short> > > > >, std::vector<short, std::allocator<short> >*>(__gnu_cxx::__normal_iterator<std::vector<short, std::allocator<short> > const*, std::vector<std::vector<short, std::allocator<short> >, std::allocator<std::vector<short, std::allocator<short> > > > >, __gnu_cxx::__normal_iterator<std::vector<short, std::allocator<short> > const*, std::vector<std::vector<short, std::allocator<short> >, std::allocator<std::vector<short, std::allocator<short> > > > >, std::vector<short, std::allocator<short> >*)
1.30 4.93 0.13 9080202 0.00 0.00 std::_Vector_base<short, std::allocator<short> >::_Vector_impl::_Vector_impl(std::allocator<short> const&)
1.25 5.05 0.12 9051640 0.00 0.00 void std::_Construct<std::vector<short, std::allocator<short> >, std::vector<short, std::allocator<short> > const&>(std::vector<short, std::allocator<short> >*, std::vector<short, std::allocator<short> > const&)
1.20 5.17 0.12 9092637 0.00 0.00 std::list<unsigned int, std::allocator<unsigned int> >::~list()
1.20 5.29 0.12 4123 0.00 0.00 void std::_Destroy_aux<false>::__destroy<std::vector<short, std::allocator<short> >*>(std::vector<short, std::allocator<short> >*, std::vector<short, std::allocator<short> >*)
1.15 5.41 0.12 34333589 0.00 0.00 std::_List_const_iterator<unsigned int>::operator!=(std::_List_const_iterator<unsigned int> const&) const
1.10 5.52 0.11 9084596 0.00 0.00 std::vector<short, std::allocator<short> >::~vector()
1.10 5.63 0.11 9082398 0.00 0.00 short* std::copy<__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, short*>(__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, __gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, short*)
1.05 5.74 0.10 9084123 0.00 0.00 std::_List_base<unsigned int, std::allocator<unsigned int> >::_List_impl::_List_impl(std::allocator<std::_List_node<unsigned int> > const&)
1.00 5.83 0.10 25532990 0.00 0.00 std::_List_iterator<unsigned int>::_List_iterator(std::__detail::_List_node_base*)
1.00 5.93 0.10 18164796 0.00 0.00 std::_Iter_base<__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, false>::_S_base(__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >)
1.00 6.04 0.10 9092637 0.00 0.00 std::_List_base<unsigned int, std::allocator<unsigned int> >::~_List_base()
1.00 6.13 0.10 9080202 0.00 0.00 std::_Vector_base<short, std::allocator<short> >::_Vector_base(unsigned int, std::allocator<short> const&)
0.95 6.23 0.10 9082398 0.00 0.00 short* std::__uninitialized_copy<true>::__uninit_copy<__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, short*>(__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, __gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, short*)
0.95 6.33 0.10 9082398 0.00 0.00 short* std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, short*>(__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, __gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, short*)
0.90 6.42 0.09 9107748 0.00 0.00 std::vector<short, std::allocator<short> >::begin() const
0.90 6.50 0.09 9086793 0.00 0.00 void std::_Destroy<short*>(short*, short*)
0.90 6.59 0.09 9085052 0.00 0.00 std::list<unsigned int, std::allocator<unsigned int> >::begin() const
0.90 6.68 0.09 4123 0.00 0.00 void std::_Destroy_aux<false>::__destroy<std::list<unsigned int, std::allocator<unsigned int> >*>(std::list<unsigned int, std::allocator<unsigned int> >*, std::list<unsigned int, std::allocator<unsigned int> >*)
0.85 6.77 0.09 18164796 0.00 0.00 std::_Miter_base<__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > > >::iterator_type std::__miter_base<__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > > >(__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >)
0.85 6.86 0.09 9084123 0.00 0.00 std::allocator<std::_List_node<unsigned int> >::allocator<unsigned int>(std::allocator<unsigned int> const&)
0.85 6.94 0.09 9055760 0.00 0.00 bool __gnu_cxx::operator!=<std::list<unsigned int, std::allocator<unsigned int> > const*, std::vector<std::list<unsigned int, std::allocator<unsigned int> >, std::allocator<std::list<unsigned int, std::allocator<unsigned int> > > > >(__gnu_cxx::__normal_iterator<std::list<unsigned int, std::allocator<unsigned int> > const*, std::vector<std::list<unsigned int, std::allocator<unsigned int> >, std::allocator<std::list<unsigned int, std::allocator<unsigned int> > > > > const&, __gnu_cxx::__normal_iterator<std::list<unsigned int, std::allocator<unsigned int> > const*, std::vector<std::list<unsigned int, std::allocator<unsigned int> >, std::allocator<std::list<unsigned int, std::allocator<unsigned int> > > > > const&)
0.80 7.02 0.08 18280452 0.00 0.00 __gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >::__normal_iterator(short const* const&)
0.80 7.10 0.08 18164796 0.00 0.00 std::_Iter_base<__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, true>::_S_base(__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >)
0.80 7.18 0.08 9092637 0.00 0.00 std::_List_base<unsigned int, std::allocator<unsigned int> >::_M_init()
0.80 7.26 0.08 9082398 0.00 0.00 short* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<short>(short const*, short const*, short*)
0.75 7.33 0.07 43405668 0.00 0.00 operator new(unsigned int, void*)
0.75 7.41 0.07 9085052 0.00 0.00 std::list<unsigned int, std::allocator<unsigned int> >::end() const
0.75 7.49 0.07 9082398 0.00 0.00 short* std::__uninitialized_copy_a<__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, short*, short>(__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, __gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, short*, std::allocator<short>&)
0.75 7.56 0.07 9053837 0.00 0.00 void std::_Destroy<std::list<unsigned int, std::allocator<unsigned int> > >(std::list<unsigned int, std::allocator<unsigned int> >*)
0.70 7.63 0.07 25470908 0.00 0.00 std::list<unsigned int, std::allocator<unsigned int> >::end()
0.70 7.70 0.07 25270362 0.00 0.00 std::_List_base<unsigned int, std::allocator<unsigned int> >::_M_get_node()
0.70 7.77 0.07 25249466 0.00 0.00 std::_List_const_iterator<unsigned int>::operator*() const
0.70 7.84 0.07 9134142 0.00 0.00 std::vector<short, std::allocator<short> >::end() const
0.70 7.91 0.07 9086793 0.00 0.00 void std::_Destroy<short*, short>(short*, short*, std::allocator<short>&)
0.70 7.98 0.07 9080202 0.00 0.00 std::allocator<short>::allocator(std::allocator<short> const&)
0.65 8.04 0.07 18170104 0.00 0.00 std::_List_const_iterator<unsigned int>::_List_const_iterator(std::__detail::_List_node_base const*)
0.65 8.11 0.07 18164796 0.00 0.00 std::_Niter_base<__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > > >::iterator_type std::__niter_base<__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > > >(__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >)
0.65 8.18 0.07 18107674 0.00 0.00 std::list<unsigned int, std::allocator<unsigned int> >* std::__addressof<std::list<unsigned int, std::allocator<unsigned int> > >(std::list<unsigned int, std::allocator<unsigned int> >&)
0.65 8.24 0.07 9051640 0.00 0.00 __gnu_cxx::__normal_iterator<std::list<unsigned int, std::allocator<unsigned int> > const*, std::vector<std::list<unsigned int, std::allocator<unsigned int> >, std::allocator<std::list<unsigned int, std::allocator<unsigned int> > > > >::operator++()
0.60 8.30 0.06 25270362 0.00 0.00 __gnu_cxx::new_allocator<std::_List_node<unsigned int> >::deallocate(std::_List_node<unsigned int>*, unsigned int)
0.60 8.36 0.06 25270362 0.00 0.00 __gnu_cxx::new_allocator<std::_List_node<unsigned int> >::destroy(std::_List_node<unsigned int>*)
0.60 8.42 0.06 18176760 0.00 0.00 __gnu_cxx::new_allocator<std::_List_node<unsigned int> >::~new_allocator()
0.60 8.48 0.06 18111520 0.00 0.00 __gnu_cxx::__normal_iterator<std::vector<short, std::allocator<short> > const*, std::vector<std::vector<short, std::allocator<short> >, std::allocator<std::vector<short, std::allocator<short> > > > >::base() const
0.60 8.54 0.06 9084596 0.00 0.00 std::_Vector_base<short, std::allocator<short> >::_Vector_impl::~_Vector_impl()
0.60 8.60 0.06 9084596 0.00 0.00 std::_Niter_base<short*>::iterator_type std::__niter_base<short*>(short*)
0.50 8.65 0.05 25270362 0.00 0.00 std::_List_node<unsigned int>::~_List_node()
0.50 8.70 0.05 18268284 0.00 0.00 __gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >::base() const
0.45 8.74 0.04 9053837 0.00 0.00 void std::_Destroy<std::vector<short, std::allocator<short> > >(std::vector<short, std::allocator<short> >*)
0.45 8.79 0.04 24348 0.00 0.00 unsigned int&& std::forward<unsigned int>(std::remove_reference<unsigned int>::type&)
0.40 8.83 0.04 18176760 0.00 0.00 std::allocator<std::_List_node<unsigned int> >::~allocator()
0.40 8.87 0.04 18107674 0.00 0.00 std::vector<short, std::allocator<short> >* std::__addressof<std::vector<short, std::allocator<short> > >(std::vector<short, std::allocator<short> >&)
0.40 8.91 0.04 9086793 0.00 0.00 void std::_Destroy_aux<true>::__destroy<short*>(short*, short*)
0.40 8.95 0.04 9084596 0.00 0.00 std::_Vector_base<short, std::allocator<short> >::_M_allocate(unsigned int)
0.40 8.99 0.04 9082398 0.00 0.00 short* std::__copy_move_a<false, short const*, short*>(short const*, short const*, short*)
0.40 9.03 0.04 9082398 0.00 0.00 short* std::uninitialized_copy<__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, short*>(__gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, __gnu_cxx::__normal_iterator<short const*, std::vector<short, std::allocator<short> > >, short*)
0.40 9.07 0.04 9051640 0.00 0.00 __gnu_cxx::__normal_iterator<std::list<unsigned int, std::allocator<unsigned int> > const*, std::vector<std::list<unsigned int, std::allocator<unsigned int> >, std::allocator<std::list<unsigned int, std::allocator<unsigned int> > > > >::operator*() const
0.35 9.11 0.04 18171389 0.00 0.00 std::_Vector_base<short, std::allocator<short> >::_M_get_Tp_allocator()
0.35 9.14 0.04 9084123 0.00 0.00 std::allocator<std::_List_node<unsigned int> >::allocator(std::allocator<std::_List_node<unsigned int> > const&)
0.35 9.18 0.04 9051640 0.00 0.00 __gnu_cxx::__normal_iterator<std::vector<short, std::allocator<short> > const*, std::vector<std::vector<short, std::allocator<short> >, std::allocator<std::vector<short, std::allocator<short> > > > >::operator++()
0.35 9.21 0.04 9051640 0.00 0.00 std::vector<short, std::allocator<short> > const& std::forward<std::vector<short, std::allocator<short> > const&>(std::remove_reference<std::vector<short, std::allocator<short> > const&>::type&)
0.35 9.24 0.04 1 0.04 0.04 redelemeier_with_pruning::full_convex_counter_3d(int, int, unsigned long long, unsigned long long, std::vector<unsigned long long, std::allocator<unsigned long long> >*, std::basic_ofstream<char, std::char_traits<char> >*)
0.30 9.28 0.03 9088244 0.00 0.00 std::allocator<unsigned int>::~allocator()
0.30 9.30 0.03 9086793 0.00 0.00 std::_Vector_base<short, std::allocator<short> >::_M_deallocate(short*, unsigned int)
0.25 9.33 0.03 25270362 0.00 0.00 __gnu_cxx::new_allocator<std::_List_node<unsigned int> >::max_size() const
0.25 9.36 0.03 9084596 0.00 0.00 __gnu_cxx::new_allocator<short>::allocate(unsigned int, void const*)
0.25 9.38 0.03 9084123 0.00 0.00 std::allocator<unsigned int>::allocator<std::_List_node<unsigned int> >(std::allocator<std::_List_node<unsigned int> > const&)
0.25 9.40 0.03 9082855 0.00 0.00 std::_List_base<unsigned int, std::allocator<unsigned int> >::_M_get_Node_allocator() const
0.20 9.43 0.02 18111520 0.00 0.00 __gnu_cxx::__normal_iterator<std::list<unsigned int, std::allocator<unsigned int> > const*, std::vector<std::list<unsigned int, std::allocator<unsigned int> >, std::allocator<std::list<unsigned int, std::allocator<unsigned int> > > > >::base() const
0.20 9.45 0.02 9092637 0.00 0.00 __gnu_cxx::new_allocator<std::_List_node<unsigned int> >::new_allocator()
0.20 9.46 0.02 9092637 0.00 0.00 std::_List_base<unsigned int, std::allocator<unsigned int> >::_List_impl::~_List_impl()
0.20 9.48 0.02 9088244 0.00 0.00 __gnu_cxx::new_allocator<unsigned int>::~new_allocator()
0.20 9.51 0.02 9084596 0.00 0.00 __gnu_cxx::new_allocator<short>::deallocate(short*, unsigned int)
0.20 9.53 0.02 9080201 0.00 0.00 std::_Vector_base<short, std::allocator<short> >::_M_get_Tp_allocator() const
0.20 9.54 0.02 9051640 0.00 0.00 __gnu_cxx::__normal_iterator<std::vector<short, std::allocator<short> > const*, std::vector<std::vector<short, std::allocator<short> >, std::allocator<std::vector<short, std::allocator<short> > > > >::operator*() const
0.20 9.56 0.02 495658 0.00 0.00 __gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >::__normal_iterator(unsigned int* const&)
0.20 9.59 0.02 34461 0.00 0.00 std::list<unsigned int, std::allocator<unsigned int> >::begin()
0.20 9.61 0.02 18637 0.00 0.00 std::_List_iterator<unsigned int>::operator==(std::_List_iterator<unsigned int> const&) const
0.20 9.62 0.02 6087 0.00 0.00 std::_List_node<unsigned int>* std::list<unsigned int, std::allocator<unsigned int> >::_M_create_node<unsigned int>(unsigned int&&)
0.20 9.64 0.02 6087 0.00 0.00 std::remove_reference<unsigned int&>::type&& std::move<unsigned int&>(unsigned int&)
0.15 9.66 0.01 9084597 0.00 0.00 __gnu_cxx::new_allocator<short>::~new_allocator()
0.15 9.68 0.01 9084123 0.00 0.00 __gnu_cxx::new_allocator<std::_List_node<unsigned int> >::new_allocator(__gnu_cxx::new_allocator<std::_List_node<unsigned int> > const&)
0.15 9.69 0.01 31742 0.00 0.00 std::vector<unsigned int, std::allocator<unsigned int> >::begin()
0.15 9.71 0.01 6087 0.00 0.00 void std::list<unsigned int, std::allocator<unsigned int> >::_M_insert<unsigned int>(std::_List_iterator<unsigned int>, unsigned int&&)
0.15 9.72 0.01 4395 0.00 0.00 __gnu_cxx::new_allocator<short>::new_allocator()
0.15 9.73 0.01 2 0.01 0.01 __gnu_cxx::new_allocator<std::vector<short, std::allocator<short> > >::new_allocator()
0.15 9.75 0.01 __gnu_cxx::__normal_iterator<short*, std::vector<short, std::allocator<short> > >::base() const
0.15 9.77 0.01 std::_Niter_base<__gnu_cxx::__normal_iterator<short*, std::vector<short, std::allocator<short> > > >::iterator_type std::__niter_base<__gnu_cxx::__normal_iterator<short*, std::vector<short, std::allocator<short> > > >(__gnu_cxx::__normal_iterator<short*, std::vector<short, std::allocator<short> > >)
0.10 9.78 0.01 9084596 0.00 0.00 __gnu_cxx::new_allocator<short>::max_size() const
0.10 9.79 0.01 9084596 0.00 0.00 std::_Iter_base<short*, false>::_S_base(short*)
0.10 9.79 0.01 9084124 0.00 0.00 __gnu_cxx::new_allocator<unsigned int>::new_allocator()
0.10 9.80 0.01 216086 0.00 0.00 bool __gnu_cxx::operator!=<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >(__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > > const&, __gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > > const&)
0.10 9.81 0.01 206056 0.00 0.00 std::_Bit_const_iterator::operator*() const
0.10 9.82 0.01 173040 0.00 0.00 std::_Bit_iterator_base::_M_bump_up()
0.10 9.84 0.01 8243 0.00 0.00 __gnu_cxx::new_allocator<unsigned long>::~new_allocator()
0.10 9.85 0.01 8242 0.00 0.00 unsigned int* std::__uninitialized_move_a<unsigned int*, unsigned int*, std::allocator<unsigned int> >(unsigned int*, unsigned int*, unsigned int*, std::allocator<unsigned int>&)
0.10 9.86 0.01 8242 0.00 0.00 void std::_Destroy<unsigned int*, unsigned int>(unsigned int*, unsigned int*, std::allocator<unsigned int>&)
0.10 9.87 0.01 8240 0.00 0.00 std::_Miter_base<unsigned long*>::iterator_type std::__miter_base<unsigned long*>(unsigned long*)
0.10 9.88 0.01 4121 0.00 0.00 std::vector<unsigned int, std::allocator<unsigned int> >::_M_check_len(unsigned int, char const*) const
0.05 9.88 0.01 9084597 0.00 0.00 std::allocator<short>::~allocator()
0.05 9.88 0.01 9080202 0.00 0.00 __gnu_cxx::new_allocator<short>::new_allocator(__gnu_cxx::new_allocator<short> const&)
0.05 9.89 0.01 9051640 0.00 0.00 std::list<unsigned int, std::allocator<unsigned int> > const& std::forward<std::list<unsigned int, std::allocator<unsigned int> > const&>(std::remove_reference<std::list<unsigned int, std::allocator<unsigned int> > const&>::type&)
0.05 9.89 0.01 186330 0.00 0.00 std::vector<unsigned int, std::allocator<unsigned int> >::size() const

How to overload the assignment operator for strings that use custom allocator

I am trying to use boost MultiIndex container in shared memory, I am using the replace function to update the records, when trying to compile, the compiler complained about the operator = being not present so I have overloaded the operator = as shown in the code below, however it seems that the compilation errors that are being thrown are because of the allocators. This is the first time I am using custom allocator for shared memory. Is there anything special that we need to do while overloading the operator = for strings with custom allocator?
1 #include <boost/interprocess/managed_shared_memory.hpp>
2 #include <boost/interprocess/allocators/allocator.hpp>
3 #include <boost/interprocess/containers/string.hpp>
4
5 #include <boost/multi_index_container.hpp>
6 #include <boost/multi_index/member.hpp>
7 #include <boost/multi_index/ordered_index.hpp>
8 #include <iostream>
9
10 using namespace boost::interprocess;
11 namespace bmi = boost::multi_index;
12
13 typedef managed_shared_memory::allocator<char>::type char_allocator;
14 typedef basic_string<char, std::char_traits<char>, char_allocator> shm_string;
15
16 //Data to insert in shared memory
17 struct tickerUpdateInfo
18 {
19 shm_string id;
20 shm_string symbol;
21 int last_update_time;
22
23 tickerUpdateInfo( const char * id_,
24 const char *symbol_,
25 int last_update_time_,
26 const char_allocator &a)
27 : id(id_, a), symbol(symbol_, a), last_update_time(last_update_time_) {
28 }
29
30 tickerUpdateInfo& operator=(const tickerUpdateInfo& other)
31 {
32 if (this != &other) {
33 id = other.id;
34 symbol = other.symbol;
35 last_update_time = other.last_update_time;
36 }
37 return *this;
38 }
39 };
40
41 std::ostream& operator<<(std::ostream& os, const tickerUpdateInfo& obj)
42 {
43 // write obj to stream
44 os << obj.id << " ";
45 os << obj.symbol << " ";
46 os << obj.last_update_time << " " << std::endl;
47 return os;
48 };
49
50
51 //Tags
52 struct id{};
53 struct symbol{};
54 struct last_update_time{};
55
56 // Define a multi_index_container of tickerUpdateInfos with following indices:
57 // - a unique index sorted by tickerUpdateInfo::id,
58 // - a unique index sorted by tickerUpdateInfo::symbol,
59 // - a non-unique index sorted by tickerUpdateInfo::last_update_time.
60 typedef bmi::multi_index_container<
61 tickerUpdateInfo,
62 bmi::indexed_by<
63 bmi::ordered_unique
64 <bmi::tag<id>, BOOST_MULTI_INDEX_MEMBER( tickerUpdateInfo, shm_string, id)>,
65 bmi::ordered_unique<
66 bmi::tag<symbol>,BOOST_MULTI_INDEX_MEMBER(tickerUpdateInfo, shm_string, symbol)>,
67 bmi::ordered_non_unique
68 <bmi::tag<last_update_time>, BOOST_MULTI_INDEX_MEMBER(tickerUpdateInfo, int, last_update_time)> >,
69 managed_shared_memory::allocator<tickerUpdateInfo>::type
70 > tickerUpdateInfo_set;
71
72 int main ()
73 {
74 //Remove shared memory on construction and destruction
75 struct shm_remove
76 {
77 shm_remove() { shared_memory_object::remove("MySharedMemory"); }
78 ~shm_remove(){ shared_memory_object::remove("MySharedMemory"); }
79 } remover;
80
81 //Create shared memory
82 managed_shared_memory segment(create_only,"MySharedMemory", 65536);
83
84 //Construct the multi_index in shared memory
85 tickerUpdateInfo_set *es = segment.construct<tickerUpdateInfo_set>
86 ("TickerUpdateContainer") //Container's name in shared memory
87 ( tickerUpdateInfo_set::ctor_args_list()
88 , segment.get_allocator<tickerUpdateInfo>()); //Ctor parameters
89
90 //Now insert elements
91 char_allocator ca(segment.get_allocator<char>());
92 es->insert(tickerUpdateInfo("0","Joe", 31,ca));
93 es->insert(tickerUpdateInfo("1", "Robert",27, ca));
94 es->insert(tickerUpdateInfo( "2","John", 36,ca));
95 const tickerUpdateInfo_set::nth_index<1>::type& name_index = (*es).get<1>();
96 std::cout << "Before update " << std::endl;
97 std::copy(
98 name_index.begin(),name_index.end(),
99 std::ostream_iterator<tickerUpdateInfo>(std::cout));
100
101
102 typedef tickerUpdateInfo_set::index<symbol>::type ticker_update_info_set_by_symbol;
103 ticker_update_info_set_by_symbol & nm_index = (*es).get<symbol>();
104 ticker_update_info_set_by_symbol::iterator it=nm_index.find("Joe");
105 tickerUpdateInfo ticker_info = *it;
106 ticker_info.symbol = "Deb"; // update key
107 nm_index.replace(it, ticker_info ); // update her record
108 std::cout << "After update " << std::endl;
109 std::copy(
110 nm_index.begin(),nm_index.end(),
111 std::ostream_iterator<tickerUpdateInfo>(std::cout));
112 return 0;
113 }
Compilation Errors:
-- Compiling src/writer.cxx
In file included from include/boost/multi_index/ordered_index.hpp:56,
from src/writer.cxx:7:
include/boost/multi_index/detail/ord_index_ops.hpp: In constructor 'boost::container::basic_string<CharT, Traits, Alloc>::basic_string(const CharT*, const A&) [with CharT = char, Traits = std::char_traits<char>, A = boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> >]':
include/boost/multi_index/detail/ord_index_ops.hpp:67: instantiated from 'Node* boost::multi_index::detail::ordered_index_find(Node*, Node*, const KeyFromValue&, const CompatibleKey&, const CompatibleCompare&) [with Node = boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<tickerUpdateInfo, boost::interprocess::allocator<tickerUpdateInfo, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > > > >, KeyFromValue = boost::multi_index::member<tickerUpdateInfo, boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > >, &tickerUpdateInfo::symbol>, CompatibleKey = char [4], CompatibleCompare = std::less<boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > > >]'
include/boost/multi_index/ordered_index.hpp:434: instantiated from 'boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<typename SuperMeta::type::node_type> > boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::find(const CompatibleKey&) const [with CompatibleKey = char [4], KeyFromValue = boost::multi_index::member<tickerUpdateInfo, boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > >, &tickerUpdateInfo::symbol>, Compare = std::less<boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > > >, SuperMeta = boost::multi_index::detail::nth_layer<2, tickerUpdateInfo, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::tag<id, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<tickerUpdateInfo, boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > >, &tickerUpdateInfo::id>, mpl_::na>, boost::multi_index::ordered_unique<boost::multi_index::tag<symbol, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<tickerUpdateInfo, boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > >, &tickerUpdateInfo::symbol>, mpl_::na>, boost::multi_index::ordered_non_unique<boost::multi_index::tag<last_update_time, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<tickerUpdateInfo, int, &tickerUpdateInfo::last_update_time>, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::interprocess::allocator<tickerUpdateInfo, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > >, TagList = boost::mpl::v_item<symbol, boost::mpl::vector0<mpl_::na>, 0>, Category = boost::multi_index::detail::ordered_unique_tag]'
src/writer.cxx:107: instantiated from here
include/boost/multi_index/detail/ord_index_ops.hpp:67: error: no matching function for call to 'boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> >::allocator()'
include/boost/interprocess/allocators/allocator.hpp:130: note: candidates are: boost::interprocess::allocator<T, SegmentManager>::allocator(const boost::interprocess::allocator<T, SegmentManager>&) [with T = char, SegmentManager = boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index>]
include/boost/interprocess/allocators/allocator.hpp:125: note: boost::interprocess::allocator<T, SegmentManager>::allocator(SegmentManager*) [with T = char, SegmentManager = boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index>]
include/boost/multi_index/detail/ord_index_ops.hpp:74: instantiated from 'Node* boost::multi_index::detail::ordered_index_find(Node*, Node*, const KeyFromValue&, const CompatibleKey&, const CompatibleCompare&) [with Node = boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<tickerUpdateInfo, boost::interprocess::allocator<tickerUpdateInfo, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > > > >, KeyFromValue = boost::multi_index::member<tickerUpdateInfo, boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > >, &tickerUpdateInfo::symbol>, CompatibleKey = char [4], CompatibleCompare = std::less<boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > > >]'
include/boost/multi_index/ordered_index.hpp:434: instantiated from 'boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<typename SuperMeta::type::node_type> > boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::find(const CompatibleKey&) const [with CompatibleKey = char [4], KeyFromValue = boost::multi_index::member<tickerUpdateInfo, boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > >, &tickerUpdateInfo::symbol>, Compare = std::less<boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > > >, SuperMeta = boost::multi_index::detail::nth_layer<2, tickerUpdateInfo, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::tag<id, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<tickerUpdateInfo, boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > >, &tickerUpdateInfo::id>, mpl_::na>, boost::multi_index::ordered_unique<boost::multi_index::tag<symbol, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<tickerUpdateInfo, boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > >, &tickerUpdateInfo::symbol>, mpl_::na>, boost::multi_index::ordered_non_unique<boost::multi_index::tag<last_update_time, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<tickerUpdateInfo, int, &tickerUpdateInfo::last_update_time>, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::interprocess::allocator<tickerUpdateInfo, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> > >, TagList = boost::mpl::v_item<symbol, boost::mpl::vector0<mpl_::na>, 0>, Category = boost::multi_index::detail::ordered_unique_tag]'
src/writer.cxx:107: instantiated from here
include/boost/multi_index/detail/ord_index_ops.hpp:74: error: no matching function for call to 'boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index> >::allocator()'
include/boost/interprocess/allocators/allocator.hpp:130: note: candidates are: boost::interprocess::allocator<T, SegmentManager>::allocator(const boost::interprocess::allocator<T, SegmentManager>&) [with T = char, SegmentManager = boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index>]
include/boost/interprocess/allocators/allocator.hpp:125: note: boost::interprocess::allocator<T, SegmentManager>::allocator(SegmentManager*) [with T = char, SegmentManager = boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index>]
Update
I have changed the structure of the code a bit and used the functor as was suggested by you, I still see the problem, I am pasting the code snippets below:
//TickerInfoMangerImplementation.cxx
1 #include <TickerInfoMangerImplementation.h>
2 #include <boost/interprocess/managed_shared_memory.hpp>
3 #include <iostream>
4
5 using namespace boost::interprocess;
6
7 tickerInfoMangerImplementation::tickerInfoMangerImplementation( const sharedMemoryNameT & name ): m_name(name),
8 m_managed_memory_segment( create_only, "test", 65536 )
9 {
10
11 p_ticker_info_set = m_managed_memory_segment.construct<ticker_update_info_set>
12 ("SetOfTickerUpdateInformation") //Container's name in shared memory
13 ( ticker_update_info_set::ctor_args_list()
14 , m_managed_memory_segment.get_allocator<tickerUpdateInfoT>()); //Ctor parameters
15 }
16
17 bool tickerInfoMangerImplementation::put_records( const tickerUpdateInfoT & record ) {
18
19 std::pair<ticker_update_info_set::iterator, bool> result_pair = p_ticker_info_set->insert( record );
20 if( result_pair.second ) {
21 return result_pair.second;
22 }
23
24 typedef ticker_update_info_set::index<symbol_index>::type ticker_update_info_set_by_symbol;
25 ticker_update_info_set_by_symbol & sym_index = (*p_ticker_info_set).get<symbol_index>();
26 ticker_update_info_set_by_symbol::iterator it = sym_index.find( record.m_symbol );
27 tickerUpdateInfoT ticker_info = *it;
28 ticker_info.m_last_update_time = record.m_last_update_time;
29 return sym_index.replace( it, ticker_info );
30 }
31
32 int tickerInfoMangerImplementation::get_active_ticker_count( const thresholdT seconds ) {
33 }
34
35 void tickerInfoMangerImplementation::print_contents() {
36 const ticker_update_info_set::nth_index<1>::type& name_index = (*p_ticker_info_set).get<1>();
37 std::copy( name_index.begin(), name_index.end(), std::ostream_iterator<tickerUpdateInfoT>(std::cout) );
38 }
39
40 std::ostream& operator<<(std::ostream& os, const tickerUpdateInfoT & obj) {
41 os << obj.m_id << " ";
42 os << obj.m_symbol << " ";
43 os << obj.m_last_update_time << " " << "\n";
44 return os;
45 };
//TickerInfoMangerImplementation.h
1 #ifndef __TICKER_INFO_MANAGER_IMPL__
2 #define __TICKER_INFO_MANAGER_IMPL__
3
4 #include <boost/interprocess/containers/string.hpp>
5 #include <boost/interprocess/shared_memory_object.hpp>
6 #include <boost/multi_index_container.hpp>
7 #include <boost/multi_index/member.hpp>
8 #include <boost/multi_index/ordered_index.hpp>
9 #include <TickerInfoManagerConstants.h>
10 #include <TickerInfo.h>
11
12 namespace bmi = boost::multi_index;
13 namespace bip = boost::interprocess;
14
15 struct id_index{};
16 struct symbol_index{};
17 struct last_update_time_index{};
18
19 struct Less {
20 template<class T, class U>
21 bool operator()(T const& t, U const& u) const {
22 return t < u;
23 }
24 };
25
25
26
27 typedef bmi::multi_index_container<
28 tickerUpdateInfoT,
29 bmi::indexed_by<
30 bmi::ordered_unique
31 <bmi::tag<id_index>, BOOST_MULTI_INDEX_MEMBER( tickerUpdateInfo, shm_string, m_id), Less>,
32 bmi::ordered_unique<
33 bmi::tag<symbol_index>,BOOST_MULTI_INDEX_MEMBER(tickerUpdateInfo, shm_string, m_symbol), Less>,
34 bmi::ordered_non_unique
35 <bmi::tag<last_update_time_index>, BOOST_MULTI_INDEX_MEMBER(tickerUpdateInfo, int, m_last_update_time), Less> >,
36 bip::managed_shared_memory::allocator<tickerUpdateInfo>::type
37 > ticker_update_info_set;
38
39 class tickerInfoMangerImplementation {
40
41 public:
42 tickerInfoMangerImplementation( const sharedMemoryNameT & name );
43
44 bool put_records( const tickerUpdateInfoT & record );
45
46 int get_active_ticker_count( const thresholdT seconds );
47
48 void print_contents();
49
50 bip::managed_shared_memory& get_managed_memory_segment() {
51 return m_managed_memory_segment;
52 }
53
54 private:
55 const sharedMemoryNameT m_name;
56 bip::managed_shared_memory m_managed_memory_segment;
57 ticker_update_info_set *p_ticker_info_set;
58 };
59 #endif
//TickerInfo.h
1 #ifndef __TICKER_INFO__
2 #define __TICKER_INFO__
3
4 #include <boost/interprocess/managed_shared_memory.hpp>
5 #include <boost/interprocess/allocators/allocator.hpp>
6 #include <boost/interprocess/containers/string.hpp>
7
8 typedef boost::interprocess::managed_shared_memory::allocator<char>::type char_allocator;
9 typedef boost::interprocess::basic_string<char, std::char_traits<char>, char_allocator> shm_string;
10
11 //Data to insert in shared memory
12 typedef struct tickerUpdateInfo{
13
14 shm_string m_id;
15 shm_string m_symbol;
16 int m_last_update_time;
17
18 tickerUpdateInfo( const char * id,
19 const char *symbol,
20 int last_update_time,
21 const char_allocator &a)
22 : m_id( id, a), m_symbol( symbol, a), m_last_update_time( last_update_time) {
23 }
24 } tickerUpdateInfoT;
25
Error Logs:
tor0, 0>, Category = boost::multi_index::detail::ordered_unique_tag]'
/home/user/droy/src/quotes/debshmutils/shmdb/src/TickerInfoMangerImplementation.cxx:29: instantiated from here
/home/dev/build/third_party/64-rhel5/boost_1_47_0/include/boost/multi_index/detail/index_base.hpp:114: error: no match for 'operator=' in 'x->boost::multi_index::detail::index_node_base::value with Value = tickerUpdateInfo, Allocator = boost::interprocess::allocator, 0ul>, boost::interprocess::iset_index> > = v'
include/TickerInfo.h:12: note: candidates are: tickerUpdateInfo& tickerUpdateInfo::operator=(tickerUpdateInfo&)
Please bear with me as I am not clear as to whats going on here. Thank You!
The problem is that ordered_unique/ordered_non_unique indexes use std::less<K> by default. When you search by a compatible key nm_index.find("Joe"), char const[] "Joe" needs to be converted to shm_string in std::less<K>::operator()(shm_string const&, shm_string const&), but shm_string constructor also requires an allocator argument.
The solution is to provide your own compare class that does not convert arguments:
struct Less
{
template<class T, class U>
bool operator()(T const& t, U const& u) const {
return t < u;
}
};
// Define a multi_index_container of tickerUpdateInfos with following indices:
// - a unique index sorted by tickerUpdateInfo::id,
// - a unique index sorted by tickerUpdateInfo::symbol,
// - a non-unique index sorted by tickerUpdateInfo::last_update_time.
typedef bmi::multi_index_container<
tickerUpdateInfo,
bmi::indexed_by<
bmi::ordered_unique<bmi::tag<id>, BOOST_MULTI_INDEX_MEMBER( tickerUpdateInfo, shm_string, id), Less>,
bmi::ordered_unique<bmi::tag<symbol>,BOOST_MULTI_INDEX_MEMBER(tickerUpdateInfo, shm_string, symbol), Less>,
bmi::ordered_non_unique<bmi::tag<last_update_time>, BOOST_MULTI_INDEX_MEMBER(tickerUpdateInfo, int, last_update_time), Less>
>,
managed_shared_memory::allocator<tickerUpdateInfo>::type
> tickerUpdateInfo_set;
tickerUpdateInfo& operator=(const tickerUpdateInfo& other) is not required, the compiler generated one does the same thing.

c++ allocator error in ios

My iPhone app is using a 3rd party software written in c++.
I have received many error reports with such a stack trace:
0 libsystem_kernel.dylib
__pthread_kill + 8
1
libsystem_pthread.dylib
pthread_kill + 58
2
libsystem_c.dylib
abort + 76
3
libc++abi.dylib
abort_message + 74
4
libc++abi.dylib
default_terminate_handler() + 198
5
libobjc.A.dylib
_objc_terminate() + 228
6
libc++abi.dylib
std::__terminate(void (*)()) + 78
7
libc++abi.dylib
__cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
8 libc++abi.dylib
operator new(unsigned long, std::nothrow_t const&)
9
MyApp
new_allocator.h line 91
void std::vector<unsigned char, std::allocator<unsigned char> >::_M_range_insert<char const*>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, char const*, char const*, std::forward_iterator_tag)
This is the relevant part of the code:
void FileDownloadClient::__OnDataArrival( const char * pData ,int nDataLen )
{
....
m_received_data.insert(m_received_data.end(),pData,pData+nDataLen); //Offending line that crashes
....
}
m_received_data is declared as an instance variable of type std::vector<uint8>
Does anyone know what might be the problem or how to approach this problem at all?
Let me know if you need other information. Thanks a lot for any help!