I've been trying Valgrind out with the following program:
#include <cstdlib>
#define BUF_SIZE 1000
int main() {
char *path = new char[BUF_SIZE]
return 0;
}
Evidently the program has a memory leak, but when I test Valgrind I get a lot of unrelated leak errors, in addition to the actual leak.
I installed Valgrind using the instructions I found in: https://www.gungorbudak.com/blog/2018/04/28/how-to-install-valgrind-on-macos-high-sierra/
I even tried the use --suppressions with darwin*.supp (from the Git Repository https://sourceware.org/git/?p=valgrind.git)
Any suggestions or advice will be welcome.
ARIAS-CSC-MBP:cpp arias$ valgrind --leak-check=yes ./test
==72896== Memcheck, a memory error detector
==72896== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==72896== Using Valgrind-3.14.0.GIT and LibVEX; rerun with -h for copyright info
==72896== Command: ./test
==72896==
==72896==
==72896== HEAP SUMMARY:
==72896== in use at exit: 19,411 bytes in 167 blocks
==72896== total heap usage: 188 allocs, 21 frees, 27,859 bytes allocated
==72896==
==72896== 64 bytes in 1 blocks are definitely lost in loss record 27 of 47
==72896== at 0x1000ACC32: calloc (in /usr/local/Cellar/valgrind/HEAD-5f900ed/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==72896== by 0x10075ABA4: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib)
==72896== by 0x10075AC5A: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib)
==72896== by 0x100759363: _read_images (in /usr/lib/libobjc.A.dylib)
==72896== by 0x100757AC4: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==72896== by 0x10076A7DA: objc_object::sidetable_retainCount() (in /usr/lib/libobjc.A.dylib)
==72896== by 0x100007C64: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==72896== by 0x100007E39: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==72896== by 0x10022271D: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==72896== by 0x100757075: _objc_init (in /usr/lib/libobjc.A.dylib)
==72896== by 0x1001ACB34: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==72896== by 0x1001ACB1B: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==72896==
==72896== 64 bytes in 1 blocks are definitely lost in loss record 28 of 47
==72896== at 0x1000ACC32: calloc (in /usr/local/Cellar/valgrind/HEAD-5f900ed/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==72896== by 0x10075ABA4: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib)
==72896== by 0x10075AC72: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib)
==72896== by 0x10075AC5A: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib)
==72896== by 0x100759363: _read_images (in /usr/lib/libobjc.A.dylib)
==72896== by 0x100757AC4: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==72896== by 0x10076A7DA: objc_object::sidetable_retainCount() (in /usr/lib/libobjc.A.dylib)
==72896== by 0x100007C64: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==72896== by 0x100007E39: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==72896== by 0x10022271D: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==72896== by 0x100757075: _objc_init (in /usr/lib/libobjc.A.dylib)
==72896== by 0x1001ACB34: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==72896==
==72896== 72 bytes in 3 blocks are possibly lost in loss record 29 of 47
==72896== at 0x1000ACC32: calloc (in /usr/local/Cellar/valgrind/HEAD-5f900ed/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==72896== by 0x1007577E2: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==72896== by 0x10076A7DA: objc_object::sidetable_retainCount() (in /usr/lib/libobjc.A.dylib)
==72896== by 0x100007C64: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==72896== by 0x100007E39: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==72896== by 0x10022271D: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==72896== by 0x100757075: _objc_init (in /usr/lib/libobjc.A.dylib)
==72896== by 0x1001ACB34: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==72896== by 0x1001ACB1B: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==72896== by 0x1000BB9C2: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==72896== by 0x100019AC5: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==72896== by 0x100019CF5: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==72896==
==72896== 1,000 bytes in 1 blocks are definitely lost in loss record 39 of 47
==72896== at 0x1000ACC32: calloc (in /usr/local/Cellar/valgrind/HEAD-5f900ed/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==72896== by 0x100000EF1: main (anothertest.cpp:8)
==72896==
==72896== 1,792 bytes in 28 blocks are definitely lost in loss record 44 of 47
==72896== at 0x1000ACC32: calloc (in /usr/local/Cellar/valgrind/HEAD-5f900ed/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==72896== by 0x10075ABA4: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib)
==72896== by 0x10075AC72: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib)
==72896== by 0x100759363: _read_images (in /usr/lib/libobjc.A.dylib)
==72896== by 0x100757AC4: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==72896== by 0x10076A7DA: objc_object::sidetable_retainCount() (in /usr/lib/libobjc.A.dylib)
==72896== by 0x100007C64: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==72896== by 0x100007E39: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==72896== by 0x10022271D: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==72896== by 0x100757075: _objc_init (in /usr/lib/libobjc.A.dylib)
==72896== by 0x1001ACB34: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==72896== by 0x1001ACB1B: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==72896==
==72896== LEAK SUMMARY:
==72896== definitely lost: 2,920 bytes in 31 blocks
==72896== indirectly lost: 0 bytes in 0 blocks
==72896== possibly lost: 72 bytes in 3 blocks
==72896== still reachable: 200 bytes in 6 blocks
==72896== suppressed: 16,219 bytes in 127 blocks
==72896== Reachable blocks (those to which a pointer was found) are not shown.
==72896== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==72896==
==72896== For counts of detected and suppressed errors, rerun with: -v
==72896== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 16 from 16)
Valgrind is currently pre-release software for macOS High Sierra. As Valgrind needs to hook at a low level into the macOS kernel (mach) it needs continual tweaking upon each major new release of macOS.
At present, that means even using development Git versions of Valgrind, there will be false-positive errors (or at least memory errors which you can do nothing about) in library code which runs within the process space of your small test executable.
Future development releases of Valgrind may addresses these system errors. You can comfortably ignore them if not reporting problems in your own code.
Related
clang is:
└──( /opt/homebrew/Cellar/llvm/13.0.1_1/bin/clang++ --version
Homebrew clang version 13.0.1
Target: arm64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/13.0.1_1/bin
ASAN_OPTIONS is detect_stack_use_after_return=false detect_leaks=1
CMakeLists.txt has:
add_compile_options(-fsanitize=address -fsanitize=leak -g)
add_link_options(-fsanitize=address)
after the program exits, lots of leaks report, but in stacktrace, all objective-c function show as <unknown module>, and the address 0x3f368001a2e367b4 also seems wrong:
Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x10343b678 in wrap_malloc+0x8c (libclang_rt.asan_osx_dynamic.dylib:arm64+0x3f678)
#1 0x19ff4d638 in _Block_copy+0x3c (libsystem_blocks.dylib:arm64+0x1638)
#2 0x3f368001a2e367b4 (<unknown module>)
#3 0x5c5b8001a2e363c4 (<unknown module>)
#4 0xea608001a2dec090 (<unknown module>)
#5 0x8e440001a2debf14 (<unknown module>)
#6 0x875a8001a2debdd0 (<unknown module>)
#7 0x2498001a2debd28 (<unknown module>)
#8 0x2a408001a2e3eab8 (<unknown module>)
#9 0x731e8001a31bbce4 (<unknown module>)
#10 0x48600001029f37dc (<unknown module>)
#11 0x102942cac in bgfx::gl::RendererContextGL::setRenderContextSize(unsigned int, unsigned int, unsigned int) renderer_gl.cpp:3475
#12 0x1028f97d0 in bgfx::gl::RendererContextGL::init(bgfx::Init const&) renderer_gl.cpp:1817
#13 0x1028f9024 in bgfx::gl::rendererCreate(bgfx::Init const&) renderer_gl.cpp:4044
#14 0x102865bc0 in bgfx::rendererCreate(bgfx::Init const&) bgfx.cpp:2606
#15 0x102866714 in bgfx::Context::rendererExecCommands(bgfx::CommandBuffer&) bgfx.cpp:2657
but while debugging, these symbols are correct shown in debugger:
so how to make them right in LeakSanitizer's report? thanks very much.
I am testing to train Emotion FerPlus emotion recognition model.
Training has cuDNN failure 8: CUDNN_STATUS_EXECUTION_FAILED error.
I am using Nvidia GPU TitanRTX 24G.
Then change the minibatch_size from 32 to 1. But still have error.
I am using CNTK-GPU docker.
The complete error messages are
About to throw exception 'cuDNN failure 8: CUDNN_STATUS_EXECUTION_FAILED ; GPU=0 ; hostname=d9150da5d531 ; expr=cudnnConvolutionForward(*m_cudnn, &C::One, m_inT, ptr(in), *m_kernelT, ptr(kernel), *m_conv, m_fwdAlgo.selectedAlgo, ptr(workspace), workspace.BufferSize(), &C::Zero, m_outT, ptr(out))'
cuDNN failure 8: CUDNN_STATUS_EXECUTION_FAILED ; GPU=0 ; hostname=d9150da5d531 ; expr=cudnnConvolutionForward(*m_cudnn, &C::One, m_inT, ptr(in), *m_kernelT, ptr(kernel), *m_conv, m_fwdAlgo.selectedAlgo, ptr(workspace), workspace.BufferSize(), &C::Zero, m_outT, ptr(out))
Traceback (most recent call last):
File "train.py", line 193, in <module>
main(args.base_folder, args.training_mode)
File "train.py", line 124, in main
trainer.train_minibatch({input_var : images, label_var : labels})
File "/root/anaconda3/envs/cntk-py35/lib/python3.5/site-packages/cntk/train/trainer.py", line 184, in train_minibatch
device)
File "/root/anaconda3/envs/cntk-py35/lib/python3.5/site-packages/cntk/cntk_py.py", line 3065, in train_minibatch
return _cntk_py.Trainer_train_minibatch(self, *args)
RuntimeError: cuDNN failure 8: CUDNN_STATUS_EXECUTION_FAILED ; GPU=0 ; hostname=d9150da5d531 ; expr=cudnnConvolutionForward(*m_cudnn, &C::One, m_inT, ptr(in), *m_kernelT, ptr(kernel), *m_conv, m_fwdAlgo.selectedAlgo, ptr(workspace), workspace.BufferSize(), &C::Zero, m_outT, ptr(out))
[CALL STACK]
[0x7fc04da7ce89] + 0x732e89
[0x7fc045a71aaf] + 0xeabaaf
[0x7fc045a7b613] Microsoft::MSR::CNTK::CuDnnConvolutionEngine<float>:: ForwardCore (Microsoft::MSR::CNTK::Matrix<float> const&, Microsoft::MSR::CNTK::Matrix<float> const&, Microsoft::MSR::CNTK::Matrix<float>&, Microsoft::MSR::CNTK::Matrix<float>&) + 0x1a3
[0x7fc04dd4f8d3] Microsoft::MSR::CNTK::ConvolutionNode<float>:: ForwardProp (Microsoft::MSR::CNTK::FrameRange const&) + 0xa3
[0x7fc04dfba654] Microsoft::MSR::CNTK::ComputationNetwork::PARTraversalFlowControlNode:: ForwardProp (std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase> const&, Microsoft::MSR::CNTK::FrameRange const&) + 0xf4
[0x7fc04dcb6e33] std::_Function_handler<void (std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase> const&),void Microsoft::MSR::CNTK::ComputationNetwork::ForwardProp<std::vector<std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase>,std::allocator<std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase>>>>(std::vector<std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase>,std::allocator<std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase>>> const&)::{lambda(std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase> const&)#1}>:: _M_invoke (std::_Any_data const&, std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase> const&) + 0x63
[0x7fc04dd04ed9] void Microsoft::MSR::CNTK::ComputationNetwork:: TravserseInSortedGlobalEvalOrder <std::vector<std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase>,std::allocator<std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase>>>>(std::vector<std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase>,std::allocator<std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase>>> const&, std::function<void (std::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase> const&)> const&) + 0x5b9
[0x7fc04dca64da] CNTK::CompositeFunction:: Forward (std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>> const&, std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>>&, CNTK::DeviceDescriptor const&, std::unordered_set<CNTK::Variable,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<CNTK::Variable>> const&, std::unordered_set<CNTK::Variable,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<CNTK::Variable>> const&) + 0x15da
[0x7fc04dc3d603] CNTK::Function:: Forward (std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>> const&, std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>>&, CNTK::DeviceDescriptor const&, std::unordered_set<CNTK::Variable,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<CNTK::Variable>> const&, std::unordered_set<CNTK::Variable,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<CNTK::Variable>> const&) + 0x93
[0x7fc04ddbf91b] CNTK::Trainer:: ExecuteForwardBackward (std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>> const&, std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>>&, CNTK::DeviceDescriptor const&, std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>>&) + 0x36b
[0x7fc04ddc06e4] CNTK::Trainer:: TrainLocalMinibatch (std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>> const&, std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>>&, bool, CNTK::DeviceDescriptor const&) + 0x94
[0x7fc04ddc178a] CNTK::Trainer:: TrainMinibatch (std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>> const&, bool, std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>>&, CNTK::DeviceDescriptor const&) + 0x5a
[0x7fc04ddc1852] CNTK::Trainer:: TrainMinibatch (std::unordered_map<CNTK::Variable,std::shared_ptr<CNTK::Value>,std::hash<CNTK::Variable>,std::equal_to<CNTK::Variable>,std::allocator<std::pair<CNTK::Variable const,std::shared_ptr<CNTK::Value>>>> const&, bool, CNTK::DeviceDescriptor const&) + 0x52
[0x7fc04eb2db22] + 0x229b22
[0x7fc057ea15e9] PyCFunction_Call + 0xf9
[0x7fc057f267c0] PyEval_EvalFrameEx + 0x6ba0
[0x7fc057f29b49] + 0x144b49
[0x7fc057f28df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc057f29b49] + 0x144b49
[0x7fc057f28df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc057f29b49] + 0x144b49
[0x7fc057f28df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc057f29b49] + 0x144b49
[0x7fc057f29cd8] PyEval_EvalCodeEx + 0x48
[0x7fc057f29d1b] PyEval_EvalCode + 0x3b
[0x7fc057f4f020] PyRun_FileExFlags + 0x130
[0x7fc057f50623] PyRun_SimpleFileExFlags + 0x173
[0x7fc057f6b8c7] Py_Main + 0xca7
[0x400add] main + 0x15d
[0x7fc056f06830] __libc_start_main + 0xf0
[0x4008b9]
CNTK is in maintenance mode now (basically deprecated). While CNTK can export to ONNX pretty OK, importing ONNX models is not really well-supported.
ONNX Runtime https://github.com/microsoft/onnxruntime now supports training, so please try it. ONNX Runtime training is actively developing and is supported, so if something doesn't quite work, it's likely the issues will be resolved fast.
I have not been able to reproduce this crash myself ever but occasionally I see (on crashlytics) user getting this. I feel the frequency of crashing has increased with GoogleMaps version 3.3.0. I am getting this crash for iOS 12 and above.
Crashed: com.apple.main-thread
0 Someapp 0x101027058 gmscore::vector::GMSMarkupPolygonInstance::CreateEntities(gmscore::base::reffed_ptr<gmscore::vector::Camera> const&, gmscore::renderer::EntityRenderer*, id<GMSEntityResources>, gmscore::renderer::ProxySortedRenderBin<std::__1::tuple<unsigned int, unsigned long, unsigned int, gmscore::base::reffed_ptr<gmscore::renderer::BaseEntity> >, gmscore::renderer::ProxySortedRenderBin::less<gmscore::base::reffed_ptr<gmscore::renderer::BaseEntity> > >*, gmscore::renderer::Behavior*, char const* const&) + 311748
1 Someapp 0x101027044 gmscore::vector::GMSMarkupPolygonInstance::CreateEntities(gmscore::base::reffed_ptr<gmscore::vector::Camera> const&, gmscore::renderer::EntityRenderer*, id<GMSEntityResources>, gmscore::renderer::ProxySortedRenderBin<std::__1::tuple<unsigned int, unsigned long, unsigned int, gmscore::base::reffed_ptr<gmscore::renderer::BaseEntity> >, gmscore::renderer::ProxySortedRenderBin::less<gmscore::base::reffed_ptr<gmscore::renderer::BaseEntity> > >*, gmscore::renderer::Behavior*, char const* const&) + 311728
2 Someapp 0x101021c90 gmscore::vector::GMSMarkupMultiZoomLinesInstance::UpdateEntities(float, gmscore::base::reffed_ptr<gmscore::vector::Camera>, gmscore::renderer::EntityRenderer*, id<GMSEntityResources>, gmscore::renderer::ProxySortedRenderBin<std::__1::tuple<unsigned int, unsigned long, unsigned int, gmscore::base::reffed_ptr<gmscore::renderer::BaseEntity> >, gmscore::renderer::ProxySortedRenderBin::less<gmscore::base::reffed_ptr<gmscore::renderer::BaseEntity> > >*, gmscore::renderer::Behavior*, char const* const&) + 290300
3 Someapp 0x10101bb94 gmscore::vector::GMSMarkupBehavior::UpdateInstanceMap(std::__1::map<unsigned long, gmscore::base::reffed_ptr<gmscore::vector::GMSMarkupInstance>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, gmscore::base::reffed_ptr<gmscore::vector::GMSMarkupInstance> > > > const&, gmscore::renderer::EntityRenderer*, bool) + 265472
4 Someapp 0x10101b428 gmscore::vector::GMSMarkupBehavior::Commit(gmscore::renderer::EntityRenderer*) + 263572
5 Someapp 0x100efa9e8 gmscore::renderer::EntityRenderer::Draw(bool) + 400
6 Someapp 0x100f9ded4 -[GMSPhoenixRenderer drawForced:] + 6452
7 Someapp 0x100f80bc8 -[GMSEntityRendererView draw] + 518060
8 Someapp 0x100f7f224 -[GMSEntityRendererView displayLinkFired:] + 511496
9 Someapp 0x100f7de10 -[GMSDisplayLink displayLinkFired:] + 506356
10 QuartzCore 0x1f9308f90 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 636
11 QuartzCore 0x1f93d2b10 display_timer_callback(__CFMachPort*, void*, long, void*) + 272
12 CoreFoundation 0x1f4eeca8c __CFMachPortPerform + 188
13 CoreFoundation 0x1f4f13690 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
14 CoreFoundation 0x1f4f12ddc __CFRunLoopDoSource1 + 440
15 CoreFoundation 0x1f4f0dc00 __CFRunLoopRun + 2096
16 CoreFoundation 0x1f4f0d0b0 CFRunLoopRunSpecific + 436
17 GraphicsServices 0x1f710d79c GSEventRunModal + 104
18 UIKitCore 0x221887978 UIApplicationMain + 212
19 Someapp 0x100511850 main + 16 (TripResultViewController+Validation.swift:16)
20 libdyld.dylib 0x1f49d28e0 start + 4
I am facing the same issue but in iOS 13 devices with GoogleMaps 3.7.0 pod.
The error only appears the first time I open the app (after installing it), but the rest of the executions are working well, maybe this give u some clues about the crash.
There is an open issue for de maps-sdk-for-ios that it's worth to keep an eye on it, because it seems to be related to a bug in the SDK:
issue tracker link
I hope this information helps to solve the problem or at least to throw some light on it ...
The issue was originally reported here: https://github.com/googlemaps/google-maps-ios-utils/issues/236
In our app we use Google Map SDK and I can reproduce this issue by zooming in on the map to the max (starting with version 3.3.0)
I reported it here: https://issuetracker.google.com/issues/148238890
I have an audio program that makes a call to AudioConverterFillComplexBuffer with the following code:
OSStatus error = AudioConverterFillComplexBuffer(recorderObj->audioConverter,
MyAudioConverterCallback,
(__bridge void *)playerLocal,
&ioOutputDataPackets,
convertedData,
&streamDesc);
When this code runs on 10.6-10.11, it works fine. When the code runs on 10.12, it crashes with the following message
Crashed Thread: 16 com.apple.audio.IOThread.client
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [0]
The call stack ends in CrashIfClientProvidedBogusAudioBufferList.
Most articles, documentation and mailing lists would say that I have a bad output buffer but for the life of me, I cannot tell what I would be doing wrong but still have my code work on all versions of MacOS but the latest. Here is how I am setting up the buffer:
AudioBufferList *convertedData = (AudioBufferList*)malloc(sizeof(AudioBufferList) * 2);
convertedData->mNumberBuffers = 1;
convertedData->mBuffers[0].mNumberChannels = 2;
convertedData->mBuffers[0].mDataByteSize = 64 * 1024;
convertedData->mBuffers[0].mData = (UInt8 *)malloc(sizeof(UInt8) * 64 * 1024);
Here is the full stack at the point of the crash
Thread 16 Crashed:: com.apple.audio.IOThread.client
0 com.apple.audio.toolbox.AudioToolbox 0x00007fff89b9a330 CADebuggerStop() + 4
1 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a21e71 CrashIfClientProvidedBogusAudioBufferList + 97
2 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2f710 AudioConverterChain::CallInputProc(unsigned int) + 646
3 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2f386 AudioConverterChain::FillBufferFromInputProc(unsigned int*, CABufferList*) + 130
4 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2f2ee BufferedAudioConverter::GetInputBytes(unsigned int, unsigned int&, CABufferList const*&) + 178
5 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2f1b2 CBRConverter::RenderOutput(CABufferList*, unsigned int, unsigned int&, AudioStreamPacketDescription*) + 106
6 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2225d BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 281
7 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2f2c3 BufferedAudioConverter::GetInputBytes(unsigned int, unsigned int&, CABufferList const*&) + 135
8 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a9369b Resampler2Wrapper::RenderOutput(CABufferList*, unsigned int, unsigned int&) + 183
9 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2225d BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 281
10 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2f2c3 BufferedAudioConverter::GetInputBytes(unsigned int, unsigned int&, CABufferList const*&) + 135
11 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2f1b2 CBRConverter::RenderOutput(CABufferList*, unsigned int, unsigned int&, AudioStreamPacketDescription*) + 106
12 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2225d BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 281
13 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2253f AudioConverterChain::RenderOutput(CABufferList*, unsigned int, unsigned int&, AudioStreamPacketDescription*) + 99
14 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a2225d BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 281
15 com.apple.audio.toolbox.AudioToolbox 0x00007fff89a21d2f AudioConverterFillComplexBuffer + 282
16 com.pc-intercom.Intercom 0x0000000107a52803 0x107a4a000 + 34819
17 com.apple.audio.units.Components 0x000000010a38c97c AUHAL::AUIOProc(unsigned int, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*) + 2324
18 com.apple.audio.CoreAudio 0x00007fff8a71f951 HALC_ProxyIOContext::IOWorkLoop() + 4369
19 com.apple.audio.CoreAudio 0x00007fff8a71e667 HALC_ProxyIOContext::IOThreadEntry(void*) + 131
20 com.apple.audio.CoreAudio 0x00007fff8a71e38b HALB_IOThread::Entry(void*) + 75
21 libsystem_pthread.dylib 0x0000000108134aab _pthread_body + 180
22 libsystem_pthread.dylib 0x00000001081349f7 _pthread_start + 286
23 libsystem_pthread.dylib 0x0000000108134221 thread_start + 13
If anyone has any suggestions on how I can debug this issue, I would greatly appreciate the help.
In MyAudioConverterCallback, ioDataPacketCount is supposed to return frames for LPCM (I guess packets are frames for uncompressed audio), so set it to:
*ioDataPacketCount = recorderObj->inputBuffer->mBuffers[0].mDataByteSize/recorderObj->streamFormat.mBytesPerFrame;
Pass a NULL AudioStreamPacketDescription to AudioConverterFillComplexBuffer instead of an array of 1 (this was causing crashes for me on 10.11). Your destination format is LPCM, so packet descriptions are unnecessary because your "packets" are all the same size.
Similarly, your source format is LPCM too, so you can remove the code that returns packet descriptions in MyAudioConverterCallback - it's also wrong.
On my machine, I get non-interleaved stereo for streamFormat which means MyAudioConverterCallback has to fill out ioData->mBuffers[1] too.
When setting up your convertedData AudioBufferList, sizePerPacket was using the source format packet size instead of the destination packet size. It should be:
sizePerPacket = mOutputFormat.mBytesPerPacket;
And finally, even when it's not crashing, this code can't be right because you're recording (say) 512 frames from the microphone, then asking the audio converter to convert 16384 - that's going to give you audio glitches.
The callback is given an audio buffer list pointed to by ioData. This
buffer list may refer to existing buffers owned and allocated by the
audio converter, in which case the callback may use them and copy
input audio data into them. However, the buffer list may also be
empty (mDataByteSize == 0 and/or mData == NULL), in which case the
callback must provide its own buffers. The callback manipulates the
members of ioData to point to one or more buffers of audio data
(multiple buffers are used with non-interleaved PCM data). The
callback is responsible for not freeing or altering this buffer until
it is called again.
In the AudioConverterComplexInputDataProc callback, When I try to return a ioData with it's mBuffers[0].mData == NULL, I got this crash.
When I run my code valgrind is giving this error.
Invalid free() / delete / delete[] / realloc()
==7363== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7363== by 0x4009F8: main (in /home/arihant/ELF/elf)
==7363== Address 0x51f3fa0 is 0 bytes inside a block of size 16 free'd
==7363== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7363== by 0x4009B1: main (in /home/arihant/ELF/elf)
==7363==
==7363==
==7363== HEAP SUMMARY:
==7363== in use at exit: 160 bytes in 4 blocks
==7363== total heap usage: 448 allocs, 448 frees, 34,684 bytes allocated
==7363==
==7363== LEAK SUMMARY:
==7363== definitely lost: 160 bytes in 4 blocks
==7363== indirectly lost: 0 bytes in 0 blocks
==7363== possibly lost: 0 bytes in 0 blocks
==7363== still reachable: 0 bytes in 0 blocks
==7363== suppressed: 0 bytes in 0 blocks
==7363== Rerun with --leak-check=full to see details of leaked memory
==7363==
==7363== For counts of detected and suppressed errors, rerun with: -v
==7363== ERROR SUMMARY: 6 errors from 2 contexts (suppressed: 2 from 2)
why I am getting 160 bytes lost though number of allocs and free are equal
my code is
18 fp = fopen("output", "r");
19 obj_elf = (Elf32_Ehdr *)malloc(sizeof(Elf32_Ehdr));
20 fread(obj_elf, 1, sizeof(Elf32_Ehdr), fp);
21
22 if (argc < 2) {
23 print_menu();
24 free(obj_elf);
25 fclose(fp);
26 return 0;
27 }
28
29 if (argv[1][0] == '-') {
30 switch (argv[1][1]) {
31 case 'e':
32 elf_header(obj_elf); /*elf header function call*/
33 break;
34 case 's':
35 read_section_header(fp, obj_elf, obj_sect_hdr);
36 print_section_header(fp, obj_sect_hdr, obj_elf);
37
38 for (i = 0; i < obj_elf->e_shnum; i++) {
39 free(obj_sect_hdr[i]);
40 free(sec_name[i]);
41 }
42 break;
43 case 'S':
44 read_section_header(fp, obj_elf, obj_sect_hdr);
45 read_symbol_table(fp, obj_elf, obj_sect_hdr, obj_sym);
46 symbol_table(fp, obj_elf, obj_sect_hdr, obj_sym);
47
48 for (i = 0; i < obj_elf->e_shnum; i++) {
49 free(obj_sect_hdr[i]);
50 free(sec_name[i]);
51 }
52 for (i = 0; i < n_entries_sym_t; i++) {
53 free(obj_sym[i]);
54 free(symbol_name[i]);
55 }
56
In main function there are many free how will I know which free is invalid??
Your answer is at the top of your output:
Invalid free() / delete / delete[] / realloc()
==7363== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7363== by 0x4009F8: main (in /home/arihant/ELF/elf)
==7363== Address 0x51f3fa0 is 0 bytes inside a block of size 16 free'd
==7363== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7363== by 0x4009B1: main (in /home/arihant/ELF/elf)
Just matching up the number of allocations and frees is not sufficient when one or more of your calls to free is invalid. You will need to build with debugging to see which free() is the problem. It looks like it's probably something allocated in read_section_header() or something else not listed.