- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
最近我一直致力于用 C 扩展编写 python 模块。(python2.7, gcc 4.1.2)一旦完成并进行测试。我发现以下总线错误。
有人知道为什么吗?
p.s 在我收到这个错误之前。我修复了
中描述的“返回 Py_False 相关错误”Application gives segmentation fault randomly in python extension functions in c++
核心由 python2.7 app.py --debug=False --multi_slaves=True
生成
Program terminated with signal 7, Bus error.
#0 0x0000003d22272cf1 in _int_malloc () from /lib64/libc.so.6
(gdb) where
#0 0x0000003d22272cf1 in _int_malloc () from /lib64/libc.so.6
#1 0x0000003d22274e4e in malloc () from /lib64/libc.so.6
#2 0x00000000004d3069 in _PyObject_GC_Malloc (basicsize=<value optimized out>
) at Modules/gcmodule.c:1445
#3 0x000000000046408c in PyType_GenericAlloc (type=0x768360, nitems=0) at Objects/typeobject.c:753
#4 0x00000000004477ec in dict_new (type=0x3d225539e0, args=, kwds=0x7fff8dcb4eb0) at Objects/dictobject.c:2301
#5 0x00000000004661c3 in type_call (type=0x3d225539e0, args=0x2b3e5a521050, kwds=0x2239bca0) at Objects/typeobject.c:721
#6 0x00000000004189cd in PyObject_Call (func=0x768360, arg=0x2b3e5a521050, kw=0x2239bca0) at Objects/abstract.c:2529
c 扩展代码如下所示
static PyObject* analyze( PyObject *self, PyObject *args )
{
int ret;
char* in;
// global variables : void* obj, char* outbuf, int outbuf_size;
if (PyArg_ParseTuple(args, "s", &in)){
ret = process(obj, in, outbuf, outbuf_size);
if ( ret == SUCCESS ) {
PyObject* py_out = PyString_FromString(outbuf);
return py_out;
} else {
Py_INCREF(Py_False);
return Py_False;
}
} else {
Py_INCREF(Py_False);
return Py_False;
}
}
~
最佳答案
FWIW 我从 python 程序中收到总线错误。原来是跟它分配共享内存有关。我在 docker 容器中运行它并且必须设置 docker run ... --shm_size=1g
如下所述: https://goblincoding.com/2018/02/19/docker-bus-error-no-space-left-on-device/
关于python - 带有 C 扩展名的 Python 中的总线错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16054204/
目录 总线是什么? 常见总线类型有哪些? 总线的串行和并行的区别? 数据总线 地址总线
从下面的代码我在 map 上添加标记,每 15 秒刷新一次并从数据库中获取新的纬度和经度。标记(巴士图像)已成功添加到 map 上并从一个位置平稳移动到另一个位置,就像汽车在路上行驶一样。现在我想要的
如果在小端处理器上运行的程序将未缓存的值 0xaabbccdd 写入地址 0,并且处理器使用 32 位宽的 AXI4 总线,那么 WDATA 的第 31-24 位是 0xaa 还是 0xdd? AXI
是否存在用于将进程内服务消息传递给另一个服务的扭曲机制?我写了一个原型(prototype)总线,看起来像 from collections import defaultdict ch
我修改了设备树文件并使用 4 个 GPIO 引脚启用了 spi,这些引脚支持 pinmux 并从 gpio 切换到 spi 功能。但是在 Linux 内核代码中,代码如何知道使用了哪个 spi 总线/
我正在使用控创嵌入式计算机通过 I2C 与 ST 微 Controller 通信。我正在使用开发适配器与 I2C 接口(interface),使用描述的简单 read() 和 write() 函数 h
我有一个需要 PEC 的 I2C/SMBus 设备我正在为它编写一个内核空间驱动程序。 在 Linux 2.6.37 上我使用 i2c_board_info实例化客户端并在那里设置标志,但现在驱动程序
我想确认我的消息已经通过 socketCAN 库保存在 CAN 总线上。socketCAN 文档描述了使用 recvmsg() 函数时的这种可能性,我对其实现有疑问。 我要实现的功能是确认我的消息在仲
下面是我的代码 #import #import int main(int argc, const char *argv[]) { char *str = "First string";
在大量使用 D-Bus 的应用程序中获得更好的时间性能有哪些好的做法? ? 以下是我们的团队通过硬敲学校学到的一些知识: 尝试将数据实体组合成一个单一的大型结构/对象,以通过 D-Bus IPC 发送
我正在Akka内核下运行Akka应用程序,该程序在其他系统上也可以正常工作。 akka { loggers = ["akka.event.slf4j.Slf4jLogger"] log
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
我是 C 语言新手,对于家庭作业考试,我必须实现一个简单的服务器套接字程序,该程序在循环中发送一些数据,并且如果客户端连接到服务器套接字(已使用 Arduino 完成,但需要相同的功能)在 raspb
我正在构建一个由许多(> 100)个相同节点组成的系统,所有节点均通过 CAN 总线连接。这个想法是所有节点必须具有相同的信息,任何节点都可以生成事件并通过 CAN 广播它。对于这些事件,CAN 帧提
您好,我在解析 IIB Toolkit 中的任何 JSON 时遇到问题。 java计算节点抛出的异常为:java.lang.NoClassDefFoundError: org.json.JSONObj
我买了这个传感器: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Weather/RHT03.pdf 输出为“MaxDetect 1-w
我正在用户空间编写包装器 API,用于在嵌入式 Linux 平台上用 C 语言控制 I2C 总线。我能够使用 read() 和 write() 方法以及 ioctl() 调用来选择从属设备,从而从传感
在我的软件(用 C++ 编写)中,我使用 Linux 标准函数打开 CAN 总线套接字并执行 I/O 操作。 套接字的打开和使用如下: /* Create the socket */ if ((
每天——大约 5 到 10 次——我的 USB 摄像头从系统中消失。它从第一天开始就发生了,因为制造商驱动程序与 Linux 不兼容。 lsusb 和 dmesg 一开始正确显示,但在较长时间后有时会
我分发了包含多个 Go 服务的应用程序。其中一些使用 Kafka 作为数据总线。我能够使用 Jaeger 的 opentracing 追踪服务之间的调用。我在图表上绘制 Kafka 跨度时遇到问题,它
我是一名优秀的程序员,十分优秀!