Comments (2)
Good question ...
I think the double underscore is because Cyclone IDL compiler follows the mapping from IDL to C specified by the OMG (https://www.omg.org/spec/C/1.0/PDF from 1997 (!)) which states in section 1.8:
For types whose parameter passing modes require heap allocation, an ORB implementation will provide allocation functions. These types include variable-length struct, variable-length union, sequence, any, string, wstring and array of a variable-length type. The return value of these allocation functions must be freed using CORBA_free(). For one of these listed types T, the ORB implementation will provide the following type-specific allocation function:
T *T__alloc();The functions are defined at global scope using the fully-scoped name of T converted into a C language name (as described in “Scoped Names” on page 1-5) followed by the suffix “__alloc” (note the double underscore). For any, string, and wstring, the allocation functions are:
CORBA_any *CORBA_any_alloc(); char *CORBA_string_alloc(); CORBA_wchar* CORBA_wstring_alloc(CORBA_unsigned_long len);
The free function in that spec is always CORBA_free
(independent of the type). The DDS spec doesn't seem to say anything about how allocation and freeing is supposed to work, but the implication of the structure of all the specs is that it would be as prescribed by the spec I just quoted. So it should be CORBA_free
! I know OpenSplice uses DDS_free
, I have no clue what the others do.
In any case having a typed free function is therefore not following the spec, and it probably should have been a double underscore. For Cyclone, this behaviour was inherited from something way older, and I think changing it isn't worth the bother. Lost in the mists of time ...
(I usually don't bother using them. I usually just do a heap- or stack-allocation and memset it to 0, and call dds_sample_free(ptr, &topic_desc, DDS_FREE_CONTENTS_BIT)
and then call free
myself if I allocated with malloc
.)
from cyclonedds.
Thanks for your answer, it helps me a lot.
from cyclonedds.
Related Issues (20)
- looks like DDS_OP_JSR is not needed anymore HOT 2
- Is there a way to replicate the deserialization mechanism used in Cyclone DDS, such as the pycdr2 library, but in the C programming language? HOT 2
- Issues with using Zenoh_bridge_dds to route data between domains HOT 9
- An implementation for dds_stream_writeLE could not be found HOT 3
- typedef in idl why not generate xxx__free() HOT 1
- CycloneDDS and eProsima Micro XRCE-DDS Communication in ROS2 HOT 6
- Allow inconsistent about DurabilityService QoS HOT 1
- Is there an implementation of Shared memory that does not through Iceoryx HOT 1
- Does CycloneDDS automatically group subscribers into multicast groups based on topic?
- Deserialization of sample failed due to reasons unknown, possibly related to a sequence HOT 29
- Two processes with the same language can communicate, but two processes with two different languages cannot communicate HOT 4
- How to subscribe to multiple topics?
- The dds_get_matched_subscription_data function be called in publication_matched listener, It can't get proxy reader's information HOT 3
- Malformed packets when streaming large messages over Ethernet HOT 5
- The frequency of subscription topic triggering is inconsistent with the frequency of publishing
- Provide Documentation to toggle between xcdr1 and xcdr2 ? HOT 2
- Checking handshake of a "topic" in a network? HOT 2
- How to config dds if using VLAN? HOT 1
- How to communicate with ROS2 and cyclonedds? HOT 1
- Does Data(M) carry unregister dispose information? what is the scenarios? 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 cyclonedds.