You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if a code instantiates several instances of MarkerDetector objects, the following exception occurs:
OpenCV Error: Insufficient memory (Failed to allocate 65408 bytes) in OutOfMemoryError
A quick gdb backtrace shows:
#0 0xb7fdd424 in __kernel_vsyscall () #1 0xadb56e0f in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #2 0xadb5a455 in __GI_abort () at abort.c:91 #3 0xadda013d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #4 0xadd9ded3 in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #5 0xadd9df0f in std::terminate() () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #6 0xadd9e0b4 in __cxa_rethrow () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #7 0xae1520a8 in cvFindContours () from/my/directory/lib/libopencv_imgproc.so.2.4 #8 0x08307649 in alvar::LabelingCvSeq::LabelSquares at /my/code/directory/src/ConnectedComponents.cpp #9 0x082ff1e1 in alvar::MarkerDetectorImpl::Detect at /my/code/directory/MarkerDetector.cpp
Cause:
LabelingCvSeq is derived from Labeling base class. Each new instance of MarkerDetector class gets a pointer to the base (Labeling) class (line 65 of MarkerDetector.h). This pointer is then assigned to a new pointer of the derived class In MarkerDetector.cpp (see line 99 in MarkerDetector.cpp). Derived class allocates memory in its constructor (line 64 in ConnectedComponents.cpp). However when the marker detector object goes out of scope, deleting the pointer to the derived class (line 40 in MarkerDetector.cpp) calls only the base class destructor, and does not call the destructor of the derived class. Since the destructor of the derived class is never being called, allocated memory by opencv is never being released. Thus, multiple instances of MarkerDetector class causes the opencv exception reported above.
The text was updated successfully, but these errors were encountered:
benersuay
added a commit
to benersuay/ar_track_alvar
that referenced
this issue
Sep 10, 2015
Symptom:
if a code instantiates several instances of MarkerDetector objects, the following exception occurs:
OpenCV Error: Insufficient memory (Failed to allocate 65408 bytes) in OutOfMemoryError
A quick gdb backtrace shows:
#0 0xb7fdd424 in __kernel_vsyscall ()
#1 0xadb56e0f in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2 0xadb5a455 in __GI_abort () at abort.c:91
#3 0xadda013d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#4 0xadd9ded3 in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#5 0xadd9df0f in std::terminate() () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#6 0xadd9e0b4 in __cxa_rethrow () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#7 0xae1520a8 in cvFindContours () from/my/directory/lib/libopencv_imgproc.so.2.4
#8 0x08307649 in alvar::LabelingCvSeq::LabelSquares at /my/code/directory/src/ConnectedComponents.cpp
#9 0x082ff1e1 in alvar::MarkerDetectorImpl::Detect at /my/code/directory/MarkerDetector.cpp
Cause:
LabelingCvSeq is derived from Labeling base class. Each new instance of MarkerDetector class gets a pointer to the base (Labeling) class (line 65 of MarkerDetector.h). This pointer is then assigned to a new pointer of the derived class In MarkerDetector.cpp (see line 99 in MarkerDetector.cpp). Derived class allocates memory in its constructor (line 64 in ConnectedComponents.cpp). However when the marker detector object goes out of scope, deleting the pointer to the derived class (line 40 in MarkerDetector.cpp) calls only the base class destructor, and does not call the destructor of the derived class. Since the destructor of the derived class is never being called, allocated memory by opencv is never being released. Thus, multiple instances of MarkerDetector class causes the opencv exception reported above.
The text was updated successfully, but these errors were encountered: