segmentation-fault

cv::remap segfaults with std::thread

江枫思渺然 提交于 2020-01-02 00:36:05
问题 I am getting segfault with the following simple code: #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include <iostream> #include <thread> #include <unistd.h> void run() { sleep(1); // see below cv::Mat source(10, 10, CV_32FC1, -1); cv::Mat result(10, 10, CV_32FC1); cv::Mat trX(result.rows, result.cols, CV_32FC1, 5); cv::Mat trY(result.rows, result.cols, CV_32FC1, 5); cv::remap(source, result, trX, trY, cv::INTER_LINEAR, cv::BORDER_TRANSPARENT); std::cout <<

Wrapping C++ dynamic array with Python+ctypes, segfault

醉酒当歌 提交于 2020-01-01 14:39:58
问题 I wanted to wrap a small C++ code allocating an array with ctypes and there is something wrong with storing the address in a c_void_p object. (Note: the pointers are intentionally cast to void* , 'cause later I want to do the allocation the same way for arrays of C++ objects, too.) The C(++) functions to be wrapped: void* test_alloc() { const int size = 100000000; int* ptr = new int[size]; std::cout << "Allocated " << size * sizeof(int) << " bytes @ " << ptr << std::endl; return static_cast

Wrapping C++ dynamic array with Python+ctypes, segfault

删除回忆录丶 提交于 2020-01-01 14:38:32
问题 I wanted to wrap a small C++ code allocating an array with ctypes and there is something wrong with storing the address in a c_void_p object. (Note: the pointers are intentionally cast to void* , 'cause later I want to do the allocation the same way for arrays of C++ objects, too.) The C(++) functions to be wrapped: void* test_alloc() { const int size = 100000000; int* ptr = new int[size]; std::cout << "Allocated " << size * sizeof(int) << " bytes @ " << ptr << std::endl; return static_cast

Why do I get a segmentation fault in my simple c++ program using libexpect.so?

白昼怎懂夜的黑 提交于 2020-01-01 09:10:12
问题 I am busy with a project where I have to automate some processes in bash or ssh so I decided to use the libexpect.so library. If you don't know what libexpect is, it provides an expect extension that I can use in a c++ program, and expect is just a program where you can run automated scripts for things like ssh. So I can execute a script which attempts to ssh somewhere...when the password prompt is found by expect I could have already given expect a password to send. My problem is that when I

Segmentation Fault on creating an array in C

a 夏天 提交于 2020-01-01 05:52:08
问题 I have recently migrated to a new laptop - HP dv6119tx (Intel Core i5, 4 GB RAM). It has Windows 7 Home Premium 64 bit installed. I am trying to create an array of type int of length 10^6 in C++ (Dev C++), which I used to create comfortably on my last laptop (32 bit Windows 7 Ultimate/Ubuntu Linux, 2GB RAM) and every other environment I have programmed on (It should take around 3.5 MB of RAM). But with the current setup, I am getting a "Segmentation Fault" error in Debug Mode. SCREENSHOTS

python ImageTk.PhotoImage - segfault

懵懂的女人 提交于 2020-01-01 04:28:27
问题 I am trying to run the following command on a Mac 10.6.8: Python 2.7.2 |EPD 7.1-2 (64-bit)| (default, Jul 27 2011, 14:50:45) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin import Image import ImageTk from Tkinter import Tk window = Tk() i = Image.open("file.jpg") photo = ImageTk.PhotoImage(i) Segmentation fault I've seen others have had a bus error in this situation. Does anyone know of a bug here or a way round it? I couldn't understand whether http://infohost.nmt.edu/tcc/help/pubs/pil/image

Is there any hard-wired limit on recursion depth in C

谁说胖子不能爱 提交于 2020-01-01 04:17:47
问题 The program under discussion attempts to compute sum-of-first-n-natural-numbers using recursion . I know this can be done using a simple formula n*(n+1)/2 but the idea here is to use recursion . The program is as follows: #include <stdio.h> unsigned long int add(unsigned long int n) { return (n == 0) ? 0 : n + add(n-1); } int main() { printf("result : %lu \n", add(1000000)); return 0; } The program worked well for n = 100,000 but when the value of n was increased to 1,000,000 it resulted in a

segmentation fault while assigning structure members in c

☆樱花仙子☆ 提交于 2019-12-31 07:29:07
问题 I have two structure in c struct data{ char *name; }; struct lst{ struct lst *next; struct table *data; }; when I'm trying to assign a name like l->data->name = d->name; printf("%s",l->data->name); it gives segmentation fault. So is it because read-only memory or caused by another reason ? ok I solved the problem : ) I've done : l->data = d; d has the name already :) thanks all 回答1: Just before you do that segmentation-violation-causing instruction, insert: printf( "%p\n", l); printf( "%p\n",

Segmentation fault in Qt application framework

别说谁变了你拦得住时间么 提交于 2019-12-31 07:24:10
问题 this generates a segmentation fault becuase of "QColor colorMap[9]";. If I remove colorMap the segmentation fault goes away. If I put it back. It comes back. If I do a clean all then build all, it goes away. If I increase its arraysize it comes back. On the other hand if I reduce it it doesnt come back. I tired adding this array to another project and What could be happening. I am really curious to know. I have removed everything else in that class. This widget subclassed is used to promote a

After Segfault: Is there a way, to check if pointer is still valid?

拜拜、爱过 提交于 2019-12-31 07:05:08
问题 I plan to create a logging/tracing mechanism, which writes the address ( const char* ) of string literals to a ring-buffer. These strings are in the read-only data-segment and are created by the preprocessor with __function__ or __file__ . The Question : Is it possible, to analyze this ring-buffer content after a Segfault, if all pointers are valid? With "valid" I mean that they point to a mapped memory area and dereferencing won't cause a segmentation fault. I'm working with Linux 2.6.3x and