segmentation-fault

Segmentation fault while redirecting sys.stdout to Tkinter.Text widget

为君一笑 提交于 2019-12-04 12:51:17
问题 I'm in the process of building a GUI-based application with Python/Tkinter that builds on top of the existing Python bdb module. In this application, I want to silence all stdout/stderr from the console and redirect it to my GUI. To accomplish this purpose, I've written a specialized Tkinter.Text object (code at the end of the post). The basic idea is that when something is written to sys.stdout, it shows up as a line in the "Text" with the color black. If something is written to sys.stderr,

LibCds: Michael Hashmap and Split Order List

家住魔仙堡 提交于 2019-12-04 12:13:20
问题 I am using libcds and they have an implementation of Michael Hash Map and Split order list. Based on the information I gathered from the doc here is how I implemented them: includes: #include <cds/map/michael_hash_map.h> #include <cds/map/split_ordered_list.h> using namespace cds; Code: class TestDs { public: virtual bool containsKey(int key)=0; virtual int get(int key)=0; virtual int put(int key, int value)=0; virtual int remove(int key)=0; virtual int size()=0; virtual const char* name()=0;

easiest way to debug crash in native library, linked by Android app?

爱⌒轻易说出口 提交于 2019-12-04 12:00:26
问题 I have ported and created several low-level C-libraries to Android for my use in my application. I cross-compiled them using the NDK, and then link to them using System.loadLibrary(). After some amount of time, my application crashes, seemingly due to a bug in the library: 07-28 11:31:21.675: INFO/DEBUG(2880): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 07-28 11:31:21.675: INFO/DEBUG(2880): Build fingerprint: 'verizon/voles/sholes/sholes:2.2.2/FRG83G/91102:user/release

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

*爱你&永不变心* 提交于 2019-12-04 10:02:42
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<void*>(ptr); } void test_dealloc(void* ptr) { int* iptr = static_cast<int*>(ptr); std::cout << "Trying

Segfault on declaring a variable of type vector<shared_ptr<int>>

孤人 提交于 2019-12-04 09:53:25
问题 Code Here is the program that gives the segfault. #include <iostream> #include <vector> #include <memory> int main() { std::cout << "Hello World" << std::endl; std::vector<std::shared_ptr<int>> y {}; std::cout << "Hello World" << std::endl; } Of course, there is absolutely nothing wrong in the program itself. The root cause of the segfault depends on the environment in which its built and ran. Background We, at Amazon, use a build system which builds and deploys the binaries ( lib and bin )

Maximum number of threads

爱⌒轻易说出口 提交于 2019-12-04 09:51:50
I have a program which accepts 2 N -digit numbers, multiplies them using threads & prints the output. The number of threads created here are 2 * N - 1 . whenever I run the program for N > 151 , the program gives me a segmentation fault. Is there a cap on maximum number of threads a process can get from the thread pool? If so, could this be a valid reason for the fault? Edit: Valgrind finds no memory leaks for N <= 150 . I'm running the program in Linux 2.6.x kernel. By default, each thread gets an 8MB stack. 300 threads by 8MB is 2.4GB just for thread stacks - if you're running in 32 bit mode,

C++ Access to vector from multiple threads

徘徊边缘 提交于 2019-12-04 09:34:05
In my program I've some threads running. Each thread gets a pointer to some object (in my program - vector). And each thread modifies the vector. And sometimes my program fails with a segm-fault. I thought it occurred because thread A begins doing something with the vector while thread B hasn't finished operating with it? Can it bee true? How am I supposed to fix it? Thread synchronization? Or maybe make a flag VectorIsInUse and set this flag to true while operating with it? vector , like all STL containers, is not thread-safe. You have to explicitly manage the synchronization yourself. A std:

What is `objc_msgSend_fixup`, exactly?

我是研究僧i 提交于 2019-12-04 09:32:09
问题 I'm messing around with the Objective-C runtime, trying to compile objective-c code without linking it against libobjc , and I'm having some segmentation fault problems with a program, so I generated an assembly file from it. I think it's not necessary to show the whole assembly file. At some point of my main function, I've got the following line (which, by the way, is the line after which I get the seg fault): callq *l_objc_msgSend_fixup_alloc and here is the definition for l_objc_msgSend

Boost.Asio segfault, no idea why

不问归期 提交于 2019-12-04 08:00:26
This is a SSCCE from my Boost.Asio project based on the examples. It took me about an hour to track the bug down to this: #include <boost/bind.hpp> #include <boost/asio.hpp> #include <boost/shared_ptr.hpp> class Connection { public: Connection(boost::asio::io_service& io_service) : socket(io_service) {} private: boost::asio::ip::tcp::socket socket; }; class Server { public: Server() : signal_monitor(io_service) { signal_monitor.add(SIGINT); signal_monitor.add(SIGTERM); signal_monitor.async_wait( boost::bind(&Server::handle_signal_caught, this) ); } void run() { // comment out the next line and

After the Ruby interpreter segfaults, is it possible to get the Ruby backtrace from the corefile?

别说谁变了你拦得住时间么 提交于 2019-12-04 07:42:23
Note: I'm using a segfault that I encountered whilst using the libxml-ruby gem to illustrate the question, but I've since fixed my problem with said gem. What this question is really about is viewing the Ruby backtrace (i.e. the same thing the interpreter prints when Ruby code fails to handle an exception) from gdb with a corefile the interpreter itself encounters a segmentation fault. I'm getting an odd segfault while generating an XML document, of all things: /railsroot/vendor/isolated/ruby-1.8/gems/libxml-ruby-1.1.2/lib/libxml/node.rb:123: [BUG] Segmentation fault ruby 1.8.7 (2011-02-18