Comments (12)
Branch issue-748 created and has the Message_Block_Test.cpp test case addition.
from ace_tao.
Riverace customer case 2124.
from ace_tao.
Thinking... changing the data_block_allocator argument from default 0 to default ACE_Allocator::instance() has the possibility of losing an error from ACE_Allocator::instance() at run time. Can anyone think of a use case where this is a real risk?
from ace_tao.
I probably don't understand the problem yet, but the default ACE_Allocator is ACE_New_Allocator. It only allocates arrays of bytes. So indeed it's correct that it uses new char[]
and delete[]
. After memory is allocated, objects may be created in those arrays of bytes using standard C++ placement-new (and destroyed using its inverse operation, explicit destruct). If you're going to integrate with the default ACE_Allocator, your own objects should behave in similar ways. The other option would be to have a custom ACE_Allocator.
from ace_tao.
Thank you for your quick response, Adam! Indeed, mandating that user-derived data blocks must be allocated with an ACE_Allocator-derived class would avoid the problem. But is that a reasonable thing to require? Is it documented anywhere that it is required now? I didn't see anything but did not look exhaustively.
The problem is a user can derive something from ACE_Data_Block, allocate one using regular, default operator new, and pass that to a new ACE_Message_Block (which does have the capability to use regular operator delete, BTW). When the ACE_Data_Block is eventually freed, it is done using ACE_Allocator, not the matching operator delete matching the allocation. AddressSanitizer (corrrectly, IMO) picks up on this as a problem.
from ace_tao.
Changing the default looks the wrong direction. @mcorino and me see two alternatives:
- Use a custom ACE_Allocator as also @mitza-oci suggest
- Provide an operator new overload on the user derived class
from ace_tao.
Why is changing the behavior the wrong direction?
from ace_tao.
I would like to look at the code in question but branch issue-748 has no commits that aren't already on master.
from ace_tao.
Oops, my bad - sorry, Adam. I just pushed the added test case for this - tests/Message_Block_Test.cpp
from ace_tao.
Redefining 0 to trigger a delete instead of using the default ACE allocator instance could probably break other users and would be a different behavior as in all other places in ACE. Personally I would go for custom allocator solution.
from ace_tao.
Besides what we've discussed already, the following simple change to the test makes the allocation and deallocation consistent. Also the DONT_DELETE flag can be used to have the application take care of data block deletion instead of ACE_Message_Block doing it.
ACE_NEW_MALLOC_RETURN (user_data_block,
static_cast<User_Data *> (
ACE_Allocator::instance ()->malloc (sizeof (User_Data))),
User_Data (),
-1);
from ace_tao.
Thank you for the code change example, Adam! I added this to the Message_Block_Test.cpp test case and proposed this to the customer.
We can consider this issue "user error" at this point.
from ace_tao.
Related Issues (20)
- GHA Windows TAO builds failing, possibly due to Perl 5.38.0 HOT 3
- reserved identifier violation HOT 3
- Throwing exceptions i.e. 'TAO_3_1_2::CORBA::MARSHAL' which is not derived from 'std::exception' HOT 4
- ".\CosNotification.idl", line 59: spelling differs from IDL keyword only in case: "EventType"
- Race condition in ACE_Future double checked locking pattern code HOT 6
- g++error,build ACE on windows with g++ HOT 5
- shell file syntax error:Unterminated quote string HOT 4
- Use after free reported by scan-build (clang version 15.0.7) in OS_NS_stdio.inl HOT 1
- SSLIOP Transports are used after being cached with entry state IDLE
- ACE_Dev_Poll_Reactor avoid handle arrays and Handler_Repository size based on RLIMIT_NOFILE
- Look at replace TAO::Object is_evaluated_/object_init_lock_ members with a std::atomic_flag HOT 2
- ACE_TAO is build in gcc 6 and above not in <5 gcc HOT 6
- Issue in generating projects & solutions for VS2019 for SSL HOT 1
- Issue in implementing SSL using ImplRepoService
- `tao_idl` Will Create a Directory Each Time a `-o*` Option is Passed
- Corbaloc resolution issue when implementing SSL with Impl Repo HOT 4
- Broken links in ACE and TAO documentation.... $ACE_ROOT/TAO doesn't exist in github version. $ACE_ROOT/../TAO does HOT 1
- Does ACE_TAO support TLS 1.3? HOT 2
- [ace6tao2] Comparison warning in CDR_Base.cpp HOT 4
- Does ACE(7.0.1)+TAO(3.0.1) supports SUSE15 SP5? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ace_tao.