Toybrick

标题: 程序报std::bad_alloc异常 [打印本页]

作者: liqiac    时间: 2020-6-4 09:49
标题: 程序报std::bad_alloc异常
C++程序,报std::bad_alloc异常,我知道是内存不够new操作失败导致。现在想知道有没有方法增加程序的内存?按理说这个板子6GB内存足够大了,我的程序用不了多少了内存的,肯定是编译命令还是哪里出错了

作者: liqiac    时间: 2020-6-4 10:39
是RTSPClient 对象调用enable函数时出了这个std::bad_alloc异常错误
作者: jefferyzhang    时间: 2020-6-4 11:03
你自己程序有内存泄漏吧?
作者: liqiac    时间: 2020-6-4 11:45
jefferyzhang 发表于 2020-6-4 11:03
你自己程序有内存泄漏吧?

我只是刚加了自己的代码进去,没调用过,不影响程序。
作者: jefferyzhang    时间: 2020-6-4 12:01
liqiac 发表于 2020-6-4 11:45
我只是刚加了自己的代码进去,没调用过,不影响程序。

gdb debug下啊
作者: liqiac    时间: 2020-6-4 14:41
jefferyzhang 发表于 2020-6-4 12:01
gdb debug下啊

seetaface6与rockchip的rtsp库有冲突吧?只要加入seetaface库,RTSPClient .enable()函数必报std::bad_alloc异常错误
作者: jefferyzhang    时间: 2020-6-4 14:47
liqiac 发表于 2020-6-4 14:41
seetaface6与rockchip的rtsp库有冲突吧?只要加入seetaface库,RTSPClient .enable()函数必报std::bad_a ...

我不知道啊,这个rtsp client都是我们另外一个工程师私自写的,没人维护的,这东西都是demo,真正要用,建议你用其他第三方更稳定的库做。。。
作者: liqiac    时间: 2020-6-4 15:01
jefferyzhang 发表于 2020-6-4 14:47
我不知道啊,这个rtsp client都是我们另外一个工程师私自写的,没人维护的,这东西都是demo,真正要用, ...

mpi: mpp version: Without VCS info
mpp_rt: NOT found ion allocator
mpp_rt: found drm allocator
[New Thread 0x7fabffeb60 (LWP 6809)]
[New Thread 0x7fab7fdb60 (LWP 6810)]
[New Thread 0x7fa9ffbb60 (LWP 6811)]
[New Thread 0x7fa97fab60 (LWP 6812)]
[2020/06/04 14:53:43] D/: listening rtp port 46923
[2020/06/04 14:53:43] D/: listening rtcp port 46924
[New Thread 0x7fa8ff9b60 (LWP 6813)]
[2020/06/04 14:53:43] D/: listening rtp port 46933
[New Thread 0x7fa3ffeb60 (LWP 6814)]
[2020/06/04 14:53:43] D/: listening rtcp port 46934
[2020/06/04 14:53:43] D/: curlto rtsp://10.55.16.115/h264/ch1/main/av_stream , cli 46923:46933, tcp: 0
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Thread 2 "facerecg" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fb110eb60 (LWP 6808)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50        ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x0000007fb3330714 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000007fb331e8e8 in __GI_abort () at abort.c:79
#2  0x0000007fb35e5b28 in __gnu_cxx::__verbose_terminate_handler() ()
    at /lib/aarch64-linux-gnu/libstdc++.so.6
#3  0x0000007fb35e38ac in  () at /lib/aarch64-linux-gnu/libstdc++.so.6
#4  0x0000007fb35e38f8 in  () at /lib/aarch64-linux-gnu/libstdc++.so.6
#5  0x0000007fb35e3bb0 in __cxa_rethrow ()
    at /lib/aarch64-linux-gnu/libstdc++.so.6
#6  0x0000007fb360abbc in  () at /lib/aarch64-linux-gnu/libstdc++.so.6
#7  0x0000007fb3908330 in bool std::__detail::__regex_algo_impl<char const*, std::allocator<std::__cxx11::sub_match<char const*> >, char, std::__cxx11::regex_traits<char>, (std::__detail::_RegexExecutorPolicy)0, false>(char const*, char const*, std::__cxx11::match_results<char const*, std::allocator<std::__cxx11::sub_match<char const*> > >&, std::__cxx11::basic_regex<char, std::__cxx11::regex_traits<char> > const&, std::regex_constants::match_flag_type) ()
    at /lib/aarch64-linux-gnu/librockchip_rtsp.so.0
#8  0x0000007fb3902510 in CurlRtsp::fParseDescribe(void*, unsigned long, unsigned long, CurlRtsp*) () at /lib/aarch64-linux-gnu/librockchip_rtsp.so.0
#9  0x0000007fb3727358 in  () at /lib/aarch64-linux-gnu/libcurl.so.4
#10 0x0000007fb373800c in  () at /lib/aarch64-linux-gnu/libcurl.so.4
#11 0x0000007fb3740a10 in  () at /lib/aarch64-linux-gnu/libcurl.so.4
#12 0x0000007fb3741e1c in curl_multi_perform () at /lib/aarch64-linux-gnu/libcurl.so.4
#13 0x0000007fb3739224 in curl_easy_perform () at /lib/aarch64-linux-gnu/libcurl.so.4
#14 0x0000007fb3901080 in CurlRtsp::describe() () at /lib/aarch64-linux-gnu/librockchip_rtsp.so.0
#15 0x0000007fb3901888 in CurlRtsp::startCurl() () at /lib/aarch64-linux-gnu/librockchip_rtsp.so.0
#16 0x0000007fb391c55c in RtspClientUnitEM::enable() () at /lib/aarch64-linux-gnu/librockchip_rtsp.so.0
#17 0x000000555555e5f8 in mythread(int, char**) (argc=3, argv=0x7fffffeff8) at testthread.cpp:190
#18 0x000000555555b3d0 in std::__invoke_impl<int, int (*)(int, char**), int, char**>(std::__invoke_other, int (*&&)(int, char**), int&&, char**&&) (__f=
    @0x55555da778: 0x555555e35c <mythread(int, char**)>, __args#0=@0x55555da770: 3, __args#1=@0x55555da768: 0x7fffffeff8) at /usr/include/c++/8/bits/invoke.h:60
#19 0x000000555555adb8 in std::__invoke<int (*)(int, char**), int, char**>(int (*&&)(int, char**), int&&, char**&&) (__fn=
    @0x55555da778: 0x555555e35c <mythread(int, char**)>, __args#0=@0x55555da770: 3, __args#1=@0x55555da768: 0x7fffffeff8) at /usr/include/c++/8/bits/invoke.h:95
#20 0x000000555555d948 in std::thread::_Invoker<std::tuple<int (*)(int, char**), int, char**> >::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) (this=0x55555da768) at /usr/include/c++/8/thread:244
#21 0x000000555555d8f0 in std::thread::_Invoker<std::tuple<int (*)(int, char**), int, char**> >:perator()() (this=0x55555da768) at /usr/include/c++/8/thread:253
#22 0x000000555555ccb0 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<int (*)(int, char**), int, char**> > >::_M_run() (this=0x55555da760) at /usr/include/c++/8/thread:196
#23 0x0000007fb360d1f4 in  () at /lib/aarch64-linux-gnu/libstdc++.so.6
#24 0x0000007fb36e57e4 in start_thread (arg=0x7fffffecff) at pthread_create.c:486
#25 0x0000007fb33cdadc in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78
(gdb)


作者: liqiac    时间: 2020-6-4 15:02
jefferyzhang 发表于 2020-6-4 14:47
我不知道啊,这个rtsp client都是我们另外一个工程师私自写的,没人维护的,这东西都是demo,真正要用, ...

有其他第三方稳定库推荐吗?可以用上RK3399的VPU的
作者: jefferyzhang    时间: 2020-6-4 15:15
liqiac 发表于 2020-6-4 15:02
有其他第三方稳定库推荐吗?可以用上RK3399的VPU的

你想全套一条龙,那就是我们这个demo,给小白用的。
你想正规写,都必须一步一步来的,先rtsp拉流、解包、mpp解码、....
作者: liqiac    时间: 2020-6-8 16:24
原因找到了,ffmpeg与RTSP或者MPP有冲突




欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3