Feat[mqb]: store AppConfig value, not a pointer to config#1329
Open
678098 wants to merge 2 commits intobloomberg:mainfrom
Open
Feat[mqb]: store AppConfig value, not a pointer to config#1329678098 wants to merge 2 commits intobloomberg:mainfrom
AppConfig value, not a pointer to config#1329678098 wants to merge 2 commits intobloomberg:mainfrom
Conversation
AppConfig value, not a pointer to config
5e9e1f7 to
1291bfc
Compare
hallfox
reviewed
Apr 24, 2026
Comment on lines
+39
to
+45
| static bsls::ObjectBuffer<mqbcfg::AppConfig> appConfig; | ||
| BSLMT_ONCE_DO | ||
| { | ||
| new (static_cast<void*>(appConfig.buffer())) | ||
| mqbcfg::AppConfig(bmqu::SingletonAllocator::allocator()); | ||
| } | ||
| return &appConfig.object(); |
Collaborator
There was a problem hiding this comment.
Do we want to have the actual objects managed by the singleton allocator? e.g.
static mqbcfg::AppConfig* appConfig_p;
BSLMT_ONCE_DO {
bslma::Allocator* alloc = bmqu::SingletonAllocator::allocator();
appConfig_p = bslma::AllocatorUtil::newObject<mqbcfg::AppConfig>(alloc);
}
return *appConfig_p;fd48040 to
c92298a
Compare
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
c92298a to
1e01e85
Compare
Signed-off-by: Evgenii Malygin <2518859+678098@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mqbcfg::BrokerConfigonly stores a pointer to an external configuration object. Due to this, the configuration object must be kept alive in runtime, or the pointer becomes invalid.It is possible to make a copy of a provided configuration and remove the restriction of keeping configuration object alive.