segmentation-fault

Armadillo + Matlab Mex segfault

北城以北 提交于 2019-12-07 23:25:32
问题 I fiddled with this the whole day, so I thought I might make everyone benefit from my experience, please see my answer below. I first had a problem with running a compiled Mex file within Matlab, because Matlab complained that it couldn't open the shared library libarmadillo . I solved this using the environment variables LD_LIBRARY_PATH and LD_RUN_PATH ( DYLD_LIBRARY_PATH and LYLD_RUN_PATH in osx). The problem remained however, that a simple test file would segfault at runtime even though

SIGSEGV within std::sort, how to narrow it down

不问归期 提交于 2019-12-07 19:39:00
问题 This is a related post to this one as it deals with the same program, but i now implemented it iterative and not recursive anymore, but I still get SIGSEGV (but later) while running the program. I did some other changes to my program to narrow it down, and I figured that changing a vector of objects, to a vector of ptr to the objects on the heap does give me some extra rounds (about 200), but still crashes. I suggest that somehow my memory to save variables within the program gets exhausted,

My Xamarin Forms app is getting crash for unknown reason

隐身守侯 提交于 2019-12-07 19:21:34
问题 The following message is shown in the Output window of Visual Studio: Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. The app crashes when navigating to the view that contains a ListView . This happens only for the first time and then after that, there are no issues. Is there a way to find out the reason behind the crash? My Xamarin Forms version is 2.5.0.280555 回答1: I have solved this

qsort segfault in C

ぐ巨炮叔叔 提交于 2019-12-07 18:13:30
I'm trying to use qsort in accordance with the man page but regardless of what I try I keep getting a segfault Here's the section of code that matters int compare_dirent(const void *a, const void *b) { const struct dirent *first = (const struct dirent *) a; const struct dirent *second = (const struct dirent *) b; return first->d_ino - second->d_ino; } int process(FILE* output,const char *dirname, int flags) { struct dirent *entries = NULL; struct dirent *table[256]; int entry_num = 0; DIR *directory = NULL; char cwd[1024]; getcwd(cwd,1024); bzero(table,256); directory = opendir(dirname); while

Segmentation Fault 11 When Using File I/O C++

蹲街弑〆低调 提交于 2019-12-07 17:15:49
问题 I am having an issue with Code Blocks and Xcode on my Mac. Every time I run the code on Code Blocks I receive Segmentation Fault 11 and when I try on Xcode I receive Thread 1: exc_bad_access (code=1 address=0x0xffffffff0000000a). However, if I run this code on a PC via Code Blocks it runs. Does anybody know how to solve this so I can run the program on my Mac. #include <iostream> #include <fstream> #include <cstdlib> using namespace std; struct Book { string isbn; string title; string author;

Writing into c-string

倾然丶 夕夏残阳落幕 提交于 2019-12-07 16:31:22
问题 my code segfaults and I don't know why. 1 #include <stdio.h> 2 3 void overwrite(char str[], char x) { 4 int i; 5 for (i = 0; str[i] != '\0'; i++) 6 str[i] = x; 7 } 8 9 int main(void) { 10 char *s = "abcde"; 11 char x = 'X'; 12 overwrite(s, x); 13 printf("%s\n", s); 14 return 0; 15 } The gdb debugger tells me, that problem is on the line 6, where I want to store a char, into c-string (if I use lvalue pointer dereferencing, it's the same problem.) This is what he says: (gdb) run Starting

Trying to use cydia libraries: NSTask on Jailbroken iphone crashes with Segmentation fault: 11

旧时模样 提交于 2019-12-07 10:29:16
问题 I want to run dpkg ( or any other binary library files from cydia in the /bin or /usr/bin directories) from a GUI app with an icon, like mobileterminal, ifile, myfile, cydia, alertscript, and so many others can. How do they accesses the libraries? This code works, and the stdout of the process is printed in nslog but then it immediately crashes with Segmentation fault: 11. this is in my viewdidload function. This DOES NOT OCCUR IN THE SIMULATOR, only my iPhone 4. weird. have tried running as

objdump with nodejs script that throws segmentation error

给你一囗甜甜゛ 提交于 2019-12-07 10:21:53
问题 I have nodejs script that throws Error: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) After I included var SegfaultHandler = require('segfault-handler'); SegfaultHandler.registerHandler("crash.log"); // With no argument, SegfaultHandler will generate a generic log file name I got this stack trace: PID 2645 received SIGSEGV for address: 0x0 0 segfault-handler.node 0x00000001034ae1c8 _ZL16segfault_handleriP9__siginfoPv + 280 1 libsystem_platform.dylib

STL List to hold structure pointers

有些话、适合烂在心里 提交于 2019-12-07 08:47:31
问题 I have a structure called vertex and I created some pointers to them. What I want to do is add those pointers to a list. My code below, when it tries to insert the pointer into the list, creates a segmentation fault. Can someone please explain what is going on? #include <iostream> #include <list> #define NUM_VERTICES 8 using namespace std; enum { WHITE, GRAY, BLACK }; struct vertex { int color; int distance; char parent; }; int main() { //create the vertices vertex r = {WHITE, NULL, NULL}; /

Segmentation fault for pthreads in a recursive call

夙愿已清 提交于 2019-12-07 08:39:20
Given the code below, I get a segmentation fault if I run it with n>16. I think it has something to do with the stack, but I can't figure it out. Could anyone give me a hand? The code is not mine, and really not important. I would just like someone to give me a hand with what is happening. This SO question is very similar, but there's not enough information (the person who posts the answer briefly talks about the problem, but then goes on to talk about a different language). Besides, notice that with two gigs and no recursion, I can (if I'm doing it right) successfully create more than 16000