Alex Rivera | Logout

Can I do a copy-on-write memcpy in Linux?

Asked 2009-10-14T09:21:46.523
31

I have some code where I frequently copy a large block of memory, often after making only very small changes to it.

I have implemented a system which tracks the changes, but I thought it might be nice, if possible to tell the OS to do a 'copy-on-write' of the memory, and let it deal with only making a copy of those parts which change. However while Linux does copy-on-write, for example when fork()ing, I can't find a way of controlling it and doing it myself.

Edit
Report

1 Answer

4

Depending on what exactly it is that you are copying, a persistent data structure might be a solution for your problem.

answered 2009-10-14T09:53:26.107

Your Answer