Skip to content
Advertisement

Tag: c++

When a large block of memory is requested on the heap, if contiguous space is not available on the RAM, is it allocated on the disk(swap)?

In Linux, when memory is requested (using calloc / malloc), if a contiguous block of the requested size is not available does the kernel map multiple separate pieces of memory into one single virtual block and hand it over to the application or is it allocated on disk? If it is allocated on disk, when a large enough block becomes

CUDA C++: Using a template function which calls a template kernel

I have a class which has a template function. This function calls a template kernel. I’m doing my development in Nsight on a Linux box. In doing this, I encounter the following pair of conflicting requirements: 1 – When implementing a template function, the definition must appear in the *.h (or *.cu.h) file since the code is not generated until

grantpt report error after unshare

I have a small program, which tries to create a pseudoterminal after unshare. the output is: The Code: If I remove flag |= CLONE_NEWUSER;, there is not error reported. Can you help to explain why this happens? thanks in advance! Answer Since I’ve had the same issue I have also looked into this. Here are my findings: grantpt(3) tries to

Proper error handling for fclose impossible (according to manpage)?

So I’m studying fclose manpage for quite I while and my conclusion is that if fclose is interrupted by some signal, according to the manpage there is no way to recover…? Am I missing some point? Usually, with unbuffered POSIX functions (open, close, write, etc…) there is ALWAYS a way to recover from signal interruption (EINTR) by restarting the call;

C compiler cannot create executables on OpenSUSE

I’ve tried to compile xdebug from sources, but I become this output: There is my config.log. I’ve found possible error: /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: i386 architecture of input file ‘/usr/lib/crt1.o’ is incompatible with i386:x86-64 output /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: i386 architecture of input file ‘/usr/lib/crti.o’ is incompatible with i386:x86-64 output /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: i386 architecture of input file ‘/usr/lib/crtn.o’ is incompatible with i386:x86-64 output /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: dynamic STT_GNU_IFUNC symbol

How to programmatically prevent linux computer from sleeping or turning on screensaver?

While developing a small cross-platform game on C++, I got stuck with following issue: when players are playing with a USB gamepad without touching a keyboard or mouse, the computer sleeps automatically while they’re playing. In Windows, it can be done easily using SetThreadExecutionState function. In OS X, I think it can be done with UpdateSystemActivity but not tested yet.

Advertisement