Ask Your Question
1

Catkin_make error: virtual memory exhausted: Cannot allocate memory [closed]

asked 2015-07-28 21:15:16 -0600

b2256 gravatar image

updated 2015-07-29 15:12:25 -0600

allenh1 gravatar image

Relative noob having enough knowledge to get into trouble.... Attempting to compile robot_localization package (along with a couple of drivers- ublox gps and christa imu). Goes along fine at first:

#### Running command: "make cmake_check_build_system" in "/media/sdcard/catkin_ws/build"
####
####
#### Running command: "make -j1 -l1" in "/media/sdcard/catkin_ws/build"
####
[  1%] Built target filter_utilities
[  1%] Built target _robot_localization_generate_messages_check_deps_SetDatum
[  1%] Built target geometry_msgs_generate_messages_cpp
[  1%] Built target std_msgs_generate_messages_cpp
[  1%] Built target _robot_localization_generate_messages_check_deps_SetPose
[  1%] Built target geographic_msgs_generate_messages_cpp
[  2%] Built target robot_localization_generate_messages_cpp
[  2%] Built target robot_localization_gencpp
[  3%] Built target filter_base
[  3%] Built target ekf
[  4%] Built target ros_filter_utilities
[  5%] Built target ukf
[  5%] Building CXX object robot_localization/CMakeFiles/ros_filter.dir/src/ros_filter.cpp.o
In file included from /opt/ros/indigo/include/ros/ros.h:40:0,
                 from /opt/ros/indigo/include/tf2_ros/buffer.h:38,
#################################################################
Then fails at the very end of the compilation:
                                  ^
/opt/ros/indigo/include/rosconsole/macros_generated.h:60:36: note: in expansion of macro ‘ROS_LOG’
 #define ROS_DEBUG_NAMED(name, ...) ROS_LOG(::ros::console::levels::Debug, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, __VA_ARGS__)
                                    ^
/opt/ros/indigo/include/tf2_ros/message_filter.h:53:3: note: in expansion of macro ‘ROS_DEBUG_NAMED’
   ROS_DEBUG_NAMED("message_filter", "MessageFilter [target=%s]: ", fmt, getTargetFramesString().c_str(), __VA_ARGS__)
   ^
/opt/ros/indigo/include/tf2_ros/message_filter.h:282:5: note: in expansion of macro ‘TF2_ROS_MESSAGEFILTER_DEBUG’
     TF2_ROS_MESSAGEFILTER_DEBUG("%s", "Cleared");
     ^
virtual memory exhausted: Cannot allocate memory
make[2]: *** [robot_localization/CMakeFiles/ros_filter.dir/src/ros_filter.cpp.o] Error 1
make[1]: *** [robot_localization/CMakeFiles/ros_filter.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j1 -l1" failed
ubuntu@arm:/media/sdcard/catkin_ws$
#############################

This is being performed on a Beaglebone Black with: Linux arm 4.1.1-ti-r2 #1 SMP PREEMPT Wed Jul 8 18:40:57 UTC 2015 armv7l armv7l armv7l GNU/Linux

I am out of ideas now. There should be plenty of memory:

ubuntu@arm:/media/sdcard/catkin_ws$ free
             total       used       free     shared    buffers     cached
Mem:        502088      43824     458264        380       3104       9768
-/+ buffers/cache:      30952     471136
Swap:            0          0          0

Any ideas are gratefully accepted! Perhaps this is too much for this board/sd card mix? (sd card is vfat FAT32) Thanks in advance, B2256


Thank you allenh1.

It seems that I was also able to find an answer based upon the swap file solution while waiting for answers. Other BBB users may also try this for a similar solution. It turns out that allenh1's point of the BBB only having 512MB is well founded and that "anything non-trivial will fail to compile with an out-of-memory error" according to the second source. Compiling was slow as noted, but appears to work aside from a clock skew warning. Thank you all again.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by allenh1
close date 2015-07-29 15:13:03.015212

Comments

sorry- hard to read formatting. Previewed fine though.

media output: ubuntu@arm:/media/sdcard/catkin_ws$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mmcblk1p1 3.6G 1.2G 2.2G 36% / none 4.0K 0 4.0K 0% /sys/fs/cgroup udev 231M 4.0K 231M 1% /dev tmpfs 50M 136K 49M 1% /run none 5.0M 0 5.0M 0% /run/lock none 246M 0 246M 0% /run/shm none 100M 0 100M 0% /run/user /dev/mmcblk0p1 7.4G 52M 7.4G 1% /media/sdcard ubuntu@arm:/media/sdcard/catkin_ws$

b2256 gravatar imageb2256 ( 2015-07-28 21:18:30 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2015-07-28 22:41:12 -0600

allenh1 gravatar image

That error is saying you ran out of RAM to compile... Which is reasonable, as you only have 512MB. Consider increasing the size of your swap partition. You could plug a usb stick in and format it as swap. Suppose it's /dev/sdb1 and formatted.

$ sudo mkswap /dev/sdb1
$ sudo swapon /dev/sdb1

Compiling will be quite slow, but you should be able to do it now.

edit flag offensive delete link more

Comments

Hello i have swap memory of 2GB on my raspberry pi 2 B still i get error of virtual memory exhausted and half of swap always stay free i am running catkin_make with -j1 argument

AniketDatar gravatar imageAniketDatar ( 2016-05-06 01:40:46 -0600 )edit

Have you considered cross-compiling? Where exactly does it fail?

allenh1 gravatar imageallenh1 ( 2016-05-16 20:48:46 -0600 )edit

thanks for suggestion i found out that the issue was with the version of compiler. now its working fine on PI. but i have another problem of same program which builds successfully but while execution i get root process killed ros error -11 (i think segmentation fault) on intel pc with core i5 laptop

AniketDatar gravatar imageAniketDatar ( 2016-05-23 08:12:42 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-07-28 21:15:16 -0600

Seen: 2,455 times

Last updated: Jul 29 '15