我正在使用 Java JNI 将Z3 Solver C-Api 集成到我们正在使用的框架中。现在,我收到以下消息的分段错误 -
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x664c4af0, pid=10878, tid=3060636480
#
# JRE version: 7.0_09-b30
# Java VM: OpenJDK Server VM (23.2-b09 mixed mode linux-x86 )
# Problematic frame:
# C [libSpdfZ3.so+0x634af0] small_object_allocator::allocate(unsigned int)+0x40
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/rajtendulkar/workspace/Java-WorkSpace/spdf-compiler_with_Yices_and_Z3_StaticLib/hs_err_pid10878.log
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
# https://bugs.launchpad.net/ubuntu/+source/openjdk-7/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
在日志文件中,它指向分配 Z3 上下文的一个调用。基本上它是一个带有一些内存分配的初始化例程。
我想尝试了解导致此分段错误的原因。我想提一下,我的程序运行一次就可以正常工作。但是,如果我在这样的 for 循环中运行它 -
for (int i=0;i<5;i++)
{
// create z3 context
Z3Object obj = new Z3Object();
...
...
.. do some exploration here ..
...
...
...
}
我只是在想这是否与内存分配或内存不足或类似的事情有关?
任何有关如何调试它的指针都值得赞赏。
编辑 :
当我有时尝试调试代码并慢慢单步执行时,我没有遇到这个问题。同样,如果我在 for 循环结束时延迟 5 秒,我不会得到任何 seg。过错。那么它是否与任何并发问题有关?