ros::package::getPath throws bad_alloc
I have quite a large ros repo and everything was working fine for a very long time. For some reason running it after Christmas I started seeing the following:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
[kinematic_simulation-5] process has died [pid 42457, exit code -6, cmd /home/jj/ws/phd_ws/ws/devel/lib/perceptive_mpc/as_mpc_simulation_node /joint_states:=/as_control/joint_states __name:=kinematic_simulation __log:=/home/jj/.ros/log/59272bc6-6995-11ec-9acb-dc8b2894491d/kinematic_simulation-5.log].
log file: /home/jj/.ros/log/59272bc6-6995-11ec-9acb-dc8b2894491d/kinematic_simulation-5*.log
I have isolated the error to the following line:
std::string packagePath = ros::package::getPath("perceptive_mpc");
I'm using melodic, docker. the perceptive_mpc package is built and sourced. The line itself is inside the package so its definitely seen. roslib is inside dependencies. I just have no clue at all. Only seen one issue similar online : https://answers.ros.org/question/2963...
Oh and most interesting of all: if I put an absolute path myself instead of using ros:package:getPath -> everything runs fine.
Absolutely any help or advice appreciated!