Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change JointPtr_t to avoid malloc #40

Open
jmirabel opened this issue Aug 26, 2016 · 2 comments
Open

Change JointPtr_t to avoid malloc #40

jmirabel opened this issue Aug 26, 2016 · 2 comments

Comments

@jmirabel
Copy link
Contributor

Currently, JointPtr_t is boost::shared_ptr<Joint>. I think it could simply be something like:

class JointPtr_t
{
DevicePtr_t d;
JointIndex jid;

Joint& operator-> ();
Joint& operator* ();
};
@nmansard
Copy link
Contributor

The smart pointers design is inherited from hpp-model for all objects except for joints. We inserted smart pointers for joints to enforce symmetry in the design. I still think that this symmetry objective is a good choice. Why did you change your mind?

@jmirabel
Copy link
Contributor Author

JointPtr_t used to be a Joint* and not a shared pointer but that's not my reason.

  1. When updating hpp-core to use hpp-pinocchio, I had a loop which was creating many JointPtr_t from new Joint implicitly. The result was that the whole code was really slow. It didn't take me long to know where the issue was because I know what functions allocate new Joint. However, this behaviour might be surprising for people not having such knowledge.
  2. IMHO, there should not be a malloc when no actual object is created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants