Skip to content

Commit

Permalink
add static to avoid frequence memory allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide authored May 12, 2018
1 parent 9fe6e23 commit 851ac43
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions velodyne_pointcloud/src/lib/rawdata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ namespace velodyne_rawdata

const raw_packet_t *raw = (const raw_packet_t *) &pkt.data[0];

// This is a more CPU and chache friendly data structure.
std::vector<LaserCorrection*> laser_corrections;
// This is a more CPU and cache friendly data structure.
static std::vector<LaserCorrection*> laser_corrections;
laser_corrections.resize(calibration_.laser_corrections.size());

for( std::map<int, LaserCorrection>::iterator it = calibration_.laser_corrections.begin();
Expand Down

1 comment on commit 851ac43

@jlblancoc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're making great improvements to the driver, thanks! 👍

Just one idea: I don't think this will be likely but just in case... why not adding the std::vector as a member of the class instead, so there are no conflicts in the event of using more than one instances of the object? (e.g. two sensors using two nodelets?)

Please sign in to comment.