我使用 RESTful API 通过 HTTP POST 请求获取数据包。然后使用 JNI 解析该数据包,并将结果返回给 java。
当它运行时,在几次 HTTP POST 请求之后,tomcat 服务器崩溃并显示错误“/usr/bin/java 中的错误:munmap_chunk():无效指针:0x00007f40b40011d0”
。
最佳答案
无论如何,我得到了答案。这是因为您在分配内存之前释放了内存。这就是我的错误的原因。
The free() function frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.
关于java - 错误 `/usr/bin/java' : munmap_chunk(): invalid pointer: in JNI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30886615/