Once, when using an industrial camera for timing photo recognition, I encountered a situation: at that time, a sub thread was used for timing photo recognition, but after running, it was found that the error of memory overflow was reported when the sub thread was opened, resulting in the collapse of the program. After exclusion, it was found that the vector variable was used in the sub thread. After using the vector variable, the memory is not cleared, resulting in saving. You should use resize to clear the memory.
Program segment with error:
vector<Mat> channels;
split(imgRect, channels);
Mat img = channels.at(0);
Program segments that can operate normally after modification:
vector<Mat> channels;
split(imgRect, channels);
Mat img = channels.at(0);
channels.resize(0);
It is hereby recorded and shared
Read More:
- The showdialog() method in thread/threading. Timer/task reported an error: “before ole can be called, the current thread must be set to single thread unit (STA) mode.”
- error: rpmdb: BDB0113 Thread/process 14536/140712790841152 failed: BDB1507 Thread died in Berkeley DB library
- How to Solve elasticSearch8.1.2 Install Error in Win10
- How to Solve Tabbarview error in Column 2021
- [Solved] error LNK2005: _bn_sub_part_words Already defined in bn_mul.obj
- How to Solve “parcel segmentation fault” Error in Linux
- How to Solve AOP error in Spring
- How to Solve Error in importing scala word2vecmodel
- How to Solve Hmaster hangs up issue due to namenode switching in Ha mode
- How to Solve dtd Error in MybatisGenerator.xml file
- How to Solve Error: EOF occurred in violation of protocol (_ssl.c:877)
- How to Solve VMware Workstation Error: This virtual machine appears to be in use.
- How to Solve webpack -v View Error in vsode
- Vue: How to Solve Error uncaught (in promise) cancel
- How to Solve Error:‘itoa’ was not declared in this scope
- Android Studio: How to Solve APK error in mobile phone installation
- [Solved] runtime error: reference binding to null pointer of type ‘std::vector<int, std::allocator<int>>‘
- How to Solve brew ERROR in `initialize‘: Version value must be a string; got a NilClass ()
- How to Solve “Status bar could not find cached time string image. Rendering in-process.” in Xcode
- C++ Error: terminating with uncaught exception of type std::out_of_range: vector Abort trap: 6