Git Product home page Git Product logo

Comments (3)

wjwwood avatar wjwwood commented on August 25, 2024

https://github.com/ros2/rcl/blob/master/rcl/include/rcl/allocator.h#L45-L52

This linked comment doesn't mention that realloc can be a null function. I think the meaning (of this comment) is that any function pointed to from here should do the realloc behavior if possible, but if not it should alloc and then dealloc if successful.

There are also several places were an error is returned in reallocate is null, e.g. https://github.com/ros2/rcl/blob/master/rcl/src/rcl/wait.c#L126-L127

That needs realloc to be set, because it just wraps it and deallocates the input pointer even if the alloc fails, i.e. the behavior of reallocf.

So I don't think it's out of step, but maybe I'm reading it differently than you. Is there a clearer statement which indicates that the realloc pointer should not be null?

from rcl.

jacquelinekay avatar jacquelinekay commented on August 25, 2024

Maybe it was just wishful thinking on my part.

As a side note, since realloc is not provided in std::allocator_traits, I created realloc from dealloc and alloc in rclcpp. Unfortunately my approach didn't work on Windows (caused a segfault in every rclcpp test). I've thrown up my hands in despair and ifdef'd out custom allocators in Windows so that the use_rcl branch can get merged:

ros2/rclcpp@c1fc16e#diff-43afa33f042770415fd58f1b74c20fcdR72

But my next step will probably be to play around with realloc on Windows to see if we can make it work and if API changes will need to be made to rcl.

from rcl.

wjwwood avatar wjwwood commented on August 25, 2024

Ok, well unless you think we should change it, can you close the issue?

from rcl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.