繁体   English   中英

在使用 AWS-SDK 抛出 'std::bad_alloc' Linux 实例后调用终止

[英]terminate called after throwing an instance of 'std::bad_alloc' Linux with AWS-SDK

我正在使用 aws sdk for linux 将文件传输到 s3。 我已经编译了 aws sdk 的共享库。文件传输失败并出现错误的分配错误,因此考虑探索 aws-sdk 给出的示例。 我正在尝试运行示例以列出 s3 链接上的存储桶。 使用命令编译应用程序:

g++ testingAws.cpp  -I . -L  . -laws-cpp-sdk-transfer -laws-cpp-sdk-core -laws-cpp-sdk-s3

每次可执行文件以消息终止时:

terminate called after throwing an instance of 'std::bad_alloc'
what():  std::bad_alloc

当它调用 function 时发生错误分配: AwsDoc::S3::PutObject(bucket_name, object_name, clientConfig); 如果我遗漏了什么任何建议。 以及如何调试错误的分配问题。

我试图列出我的 s3 服务器上的存储桶。 回溯:

Backtrace: terminate called after throwing an instance of 'std::bad_alloc' what():
  std::bad_alloc Thread 1 "a.out" received signal SIGABRT, Aborted.
  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737314626112) at ./nptl/pthread_kill.c:44 44
  ./nptl/pthread_kill.c: No such file or directory.
  (gdb) bt 
  #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737314626112) at ./nptl/pthread_kill.c:44
  #1  __pthread_kill_internal (signo=6, threadid=140737314626112) at ./nptl/pthread_kill.c:78
  #2  __GI___pthread_kill (threadid=140737314626112, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
  #3  0x00007ffff6b2d476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
  #4  0x00007ffff6b137f3 in __GI_abort () at ./stdlib/abort.c:79
  #5  0x00007ffff6dd5bbe in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #6  0x00007ffff6de124c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #7  0x00007ffff6de12b7 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff6de1518 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #9  0x00007ffff6dd57cc in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #10 0x00007ffff6e7ee6f in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #11 0x00007ffff6e7f22d in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #12 0x000055555555b58d in Aws::S3::Model::PutObjectRequest::SetBucket(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
  #13 0x000055555555a78b in AwsDoc::S3::PutObject(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Aws::Client::ClientConfiguration const&) ()
  #14 0x0000000000000000 in ?? () 
  (gdb

已经解决了。 我使用的是来自 windows 的 header 文件。没有编译错误所以认为一切都应该按预期工作但后来我从 Linux 机器上获取了 header 文件并且已经解决了它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM