FAQ Database Discussion Community


Implementing copy-on-write buffer with mmap on Mac OS X

c,osx,mmap,copy-on-write
I've been playing around with copy-on-write buffers on Linux and the following example seems to work as intended: #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <string.h> #define SIZE 4096 #define SHM_NAME "foobar" int main(void) { int fd = shm_open(SHM_NAME, O_RDWR | O_CREAT,...

In place modification of matrices in R

r,matrix,data.table,copy-on-write
I there any way to avoid copy-on-modify for in-place modifications of matrices in R? I am trying to copy a smaller matrix to a slice of larger matrix as follows. library(data.table) y <- matrix(c(11,21,31,12,22,32),nrow=3,ncol=2) address(y) [1] "08429190" y[2:3,] <- matrix(c(1,1,8,12),nrow=2) address(y) [1] "0E033D28" ...