My application occasionally crashes with the following error message:
_int_malloc: Assertion `(bck->bk->size & 0x4) == 0' failed.
I am on Ubuntu 12.04, so I ran the application again with gdb
. When the crash occurs, this is the bt
output:
0 0x00007fffeedb8035 in raise () from /lib/x86_64-linux-gnu/libc.so.6
1 0x00007fffeedbb79b in abort () from /lib/x86_64-linux-gnu/libc.so.6
2 0x00007fffeedfefed in ?? () from /lib/x86_64-linux-gnu/libc.so.6
3 0x00007fffeee02500 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
4 0x00007fffeee03e85 in malloc () from /lib/x86_64-linux-gnu/libc.so.6
5 0x00007fff8f38f56b in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
6 0x00007fff8f393115 in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
7 0x00007fff8f39352a in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
8 0x00007fff8f2de77a in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
9 0x00007fff8f2df310 in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
10 0x00007fff8f2ac33a in cuMemAllocPitch_v2 () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
11 0x00007fffe7c842d2 in ?? () from /usr/local/cuda/lib64/libcudart.so.7.0
12 0x00007fffe7c674c6 in ?? () from /usr/local/cuda/lib64/libcudart.so.7.0
13 0x00007fffe7c94278 in cudaMallocPitch () from /usr/local/cuda/lib64/libcudart.so.7.0
14 0x00007fffefa40305 in CudaFuncTable::mallocPitch(void*,unsigned long, unsigned long, unsigned long) const () from /usr/local/lib/libopencv_core.so.2.4
15 0x00007fffefa3c34c in cv::gpu::GpuMat::create(int, int, int)() from /usr/local/lib/libopencv_core.so.2.4
16 0x00007fffefa3c502 in cv::gpu::GpuMat::upload(cv::Mat const&) () from /usr/local/lib/libopencv_core.so.2.4
17 0x0000000000483fb3 in of_driving::computeOpticalFlowField (this=0xa4a710, prevImg=..., img=...) at /home/ubu1204/Documents/Software/NAO/qi_work_tree/potentialNavigationNAO/of_driving.cpp:570
18 0x0000000000483360 in of_driving::run (this=0xa4a710, img=..., prev_img=..., save_video=false, rec=true, move_robot=true) at /home/ubu1204/Documents/Software/NAO/qi_work_tree/potentialNavigationNAO/of_driving.cpp:421
19 0x0000000000476bf7 in potentialNavigationNAO::run(this=0xa4a280) at /home/ubu1204/Documents/Software/NAO/qi_work_tree/potentialNavigationNAO/potentialNavigationNAO.cpp:396
20 0x000000000047e093 in AL::detail::ALFunctor_0<potentialnavigationnao, void="">::call (this=0xa6e690) at /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/include/alcommon/detail/alfunctorwithoutreturn.h:32
21 0x00007ffff079937a in AL::ALModuleCoreImpl::execute(std::string const&, AL::ALValue const&, AL::ALValue&)() from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/libalcommon.so
22 0x00007ffff07e4cee in AL::ALBrokerImpl::methodCall(std::string const&, std::string const&, AL::ALValue const&, AL::ALValue&) ()
from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/libalcommon.so23 0x00007ffff07be206 in AL::albroker__callNaoqi(soap*, std::string, std::string, AL::ALValue, AL::albroker__callNaoqiResponse&) ()
from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/libalcommon.so24 0x00007fffeeb69d9b in AL::soap_serve_albroker__callNaoqi(soap*) () from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/libalsoap.so
25 0x00007fffeeb6d2e4 in AL::soap_serve(soap*) () from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/libalsoap.so
26 0x00007ffff07d7914 in AL::process_request::run() () from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/libalcommon.so
27 0x00007fffee6ecbbb in AL::ALThread::runTask() () from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/libalthread.so
28 0x00007fffee6ee661 in AL::_AL_Thread_Pool_Atom(void*) () from /home/ubu1204/Documents/Software/NAO/naoqi-sdk-1.14.5-linux64/lib/libalthread.so
29 0x00007ffff004ce9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
30 0x00007fffeee7536d in clone () from /lib/x86_64-linux-gnu/libc.so.6
The points related to functions that I explicitely wrote are the 16
-19
. In particular, the row 16
shows the upload()
method to load a Gpu matrix, related to the pair of code lines:
GpuMat gpuImg8U(img);
GpuMat gpuPrevImg8U(prevImg);
From there, it seems that a bad memory allocation memory. The fault does not always happen, because the code runs inside a loop, and most of the time it runs without problems.
Can you suggest me a possible reason for this type of issue? Thanks in advance