segmentation-fault

Copy argv into new array

风格不统一 提交于 2020-01-03 11:32:53
问题 I'm getting a segmentation fault for the following code. Can somebody explain why? I would like to be able to copy the contents of argv into a new array, which I called rArray. #include <iostream> using namespace std; int main( int argc, char **argv) { char **rArray; int numRows = argc; cout << "You have " << argc << " arguments:" << endl << endl; cout << "ARGV ARRAY" << endl; for (int i = 0; i < argc; i++) { cout << argv[i] << endl; } cout << endl << endl << "COPIED ARRAY" << endl; for(int i

segfault using SWIG converted code for tcl

徘徊边缘 提交于 2020-01-03 03:13:10
问题 I'm having a segmentation fault with my program. In fact I write a library in C++ and convert it for tcl using SWIG. The segfault occurs here: return Tcl_NewIntObj(static_cast< int >(value)); where value=0 the gdb back trace shows: (gdb) bt #0 0x000054b6 in ?? () #1 0xb6650d5d in SWIG_From_long (value=0) at mntdisplay_wrap.cc:1712 #2 SWIG_From_int (value=0) at mntdisplay_wrap.cc:1722 #3 Testguimnt_Init (interp=0x9714e28) at mntdisplay_wrap.cc:3774 #4 0xb76748fe in Tcl_LoadObjCmd () from /opt

plyr split_indices function crashes for long vectors

亡梦爱人 提交于 2020-01-02 07:52:10
问题 I am trying to run acast function from the package reshape2 on a large data set, and getting the program crash. I was able to localize this problem: library(plyr) n <- 15784000 g <- 1:n split_indices(g, n) # NOTE for copy/pasters: # this may result in an abort and R exit I am getting the following error message: *** caught segfault *** address 0x7ffffc3c44f0, cause 'memory not mapped' Traceback: 1: .Call("split_indices", group, as.integer(n)) 2: split_indices(g, n) If I reduce the value of n:

Linux - run android emulator on Nouveau driver

馋奶兔 提交于 2020-01-02 07:50:58
问题 Linux (Debian Sid x64), kernel 4.14, Nvidia GPU. I am unable to run Android emulator on open Nouveau drivers. There is no any error message that I can post, jus segmentation fault. When I choose software rendering, it works but unusable (it runs very slow). Does anybody know any workaround for that, or I am forced to use official Nvidia drivers? 来源: https://stackoverflow.com/questions/47900233/linux-run-android-emulator-on-nouveau-driver

Android installing apk to device gives [SEGMENTATION FAULT]

拟墨画扇 提交于 2020-01-02 05:29:06
问题 i have a problem. When i am trying to deploy (Debug or Run) my App with the AndroidStudio, i get the following error in the RunLog Waiting for device. Target device: samsung-galaxy_nexus-WOVCBUF6BAGENRTO Uploading file local path: C:\Users\Abracadabra\Desktop\......\app\build\outputs\apk\app-debug.apk remote path: /data/local/tmp/xxx.xxx.app Installing xxx.xxx.app DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/xxx.xxx.app" Segmentation fault It works fine when i try to deploy it to the

Why does allocating a large element on the stack not fail in this specific case?

橙三吉。 提交于 2020-01-02 04:58:05
问题 When allocating a int as well as a large array on the stack in C, the program executes without error. If I however, initialize the variable on the stack beforehand, it crashes with a segfault (probably because the stack size was exceeded by the large array). If initializing the variable after declaring the array this would make sense to me. What causes this behavior, memory wise? I was under the impression, that by simply declaring a variable on the stack, the needed space would be allocated,

C++: Is using segvcatch safe?

自作多情 提交于 2020-01-02 04:29:47
问题 I just stumbled upon the segvcatch library which promises to wrap segfaults and floating point errors into appropriate exceptions. Is using this library safe, if I add the precondition that all segfaults caught will only be null pointer accesses (i.e., no array overflows or invalid pointers which could have screwed up the memory completely before segfaulting, resulting in undefined behaviour anyway)? Will the program still have defined semantics after catching a nullptr segfault? What about

Segmentation fault in std::map::insert(…)

我们两清 提交于 2020-01-02 03:24:14
问题 i've used search but i didn't find answer satisfying me... so.. this is chunk of code: //VoteContainer.h typedef uint32_t order_id_t; typedef int driver_id_t; class Vote { public: enum DriverVoteResponse {YES, NO, TIMEOUT}; struct DriverResponse { driver_id_t driver_id; time_t time; DriverVoteResponse response; }; Vote() : m_order_id(0), m_time_until(0) {}; Vote(order_id_t inOrderId, std::vector<driver_id_t> inPermittedDrivers, int inSeconds); Vote(const Vote & other) : m_order_id(other.m

Understanding the output of electric fence and gdb

寵の児 提交于 2020-01-02 02:12:10
问题 When debugging a program that terminates with a segfault, electric fence, in conjunction with gdb, returns this: "ElectricFence Exiting: mprotect() failed: Cannot allocate memory [Thread 0xb0bd4b70 (LWP 5363) exited] Program exited with code 0377. I actually thought electric fence would be more helpful. What does this mean? How can I interpret this piece of information? There doesn't seem to be any stack left that I can look at, or at least bt won't return anything. Any suggestion would be

Fortran 90 - “Segmentation fault - invalid memory reference” with scalable 3D array

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-02 01:17:07
问题 I have compiled a fortran 90 program with gfortran which builds a scalable 3D array in a way I want. Upon running, I get the following error: Program received signal SIGSEGV: Segmentation fault - invalid memory reference. Backtrace for this error: #0 0x10542ee42 #1 0x10542f60e #2 0x7fff8d7895a9 #3 0x10542575e #4 0x105425975 #5 0x105425d0e Segmentation fault: 11 I believe this is a memory issue with the large 3D array, as it works if I decrease the dimensions, but is there anyway to get around