raffaello-camoriano / RBDemo

Reactive Behaviors Demo
1 stars 0 forks source link

Dynamic allocation issues #17

Closed alecive closed 10 years ago

alecive commented 10 years ago

If you dynamically allocate variables, please remember to delete them! Some of your variables are not doing that.

GiuliaP commented 10 years ago

I dynamically allocate 2 iCubArm objects, and now I delete them at line 469. Then I declare pointers to IEncoders objects at line 153, initialize them to NULL at line 205, and attach them to their DeviceDriver at line 254. If I delete them (at line 474), the module doesn't close and I got a runtime error at that point, that's why I commented lines 474-476... Is this correct? Am I missing other variables? [PS: how can I insert links to lines of code?]

alecive commented 10 years ago

I was referring to the 2 iCubArms. As a rule, for any new you should have a delete, and that's it. The iEncoders shouldn't be handled that way because they're not dynamically allocated.

[for the links, if you browse the code on github you can click on the line and you'll have a url that points there]