Skip to content
Advertisement

Tag: c++

SIGPROF kills my server when using google perftools

I have a multithreaded server process, written in C/C++ that I am trying to profile with Google perftools. However when I run the process with perftools, pretty soon my server stops with a “syscall interrupted” error, that I think is being caused by the incoming SIGPROF. (The actual system call that is being interrupted is deep inside my call to

qt5: why 2 processes and memory usage?

I uses 64 linux with fresh install of qt 5.1.0. I take example application qtbase/examples/widgets/widgets/lineedits and run, let’s call it qt5_lineedit, also I take the similar app from qt4 sources build it with qt4 library and run. And in htop I see that, there are two qt5_lineedit (I run only one, so it used 2 threads) and memory usage: VIRT

Counter increase in child & parent with fork()

I’ve a problem with this little program: I increase the counter in the child but in the parent the counter not increase… why? Thank you everyone Answer That’s because after fork, parent process and child process are different processes, and they each have their own copy of the variable count.

Extract pointer to data from GPtrArray

I’m using GPtrArray structure to hold pointers to chunks of dynamically allocated memory. As I need as simple as possible and correct freeing of memory I set callback g_ptr_array_new_with_free_func () which will free one element of pointer array. Thus when I call g_ptr_array_free() for all elements of array is called callback which correctly freeing allocated memory. Here is some pseudo

Simple socket forwarding in linux

The scenario is pretty simple: Using TCP/IP I have a client which connects to me (server) I want to forward the data the socket sends me to another socket which I opened and the data I received from that socket backwards.Just like a proxy. Right now I have 1 thread one who listens from incoming connection and spawns another 2

Adding content to middle of file..without reading it till the end

I have read various questions/answers here on unix.stackexchange on how to add or remove lines to/from a file without needing to create a temporary file. https://unix.stackexchange.com/questions/11067/is-there-a-way-to-modify-a-file-in-place?lq=1 It appears all these answers need one to atleast read till end of the file, which can be time consuming if input is a large file. Is there a way around this? I would

Advertisement