Whjat I was wondering since a long time now is whether it is possible to map a part of the current heap memory onto another one in a Copy-On-Write-Manner, like it is done when fork(2)-ing under Linux, just that the same process can request it explicitly.
In theory, using some magic with libsigsegv should make it possible to do something like "copy on read" - apply libsigsegv on a part of the memory which is allocated but not written yet, and copy the pages when they are accessed. With even more magic, one may redirect this access to the previous memory part. But that sounds ... slow.
It is not that I need something like that. It is just that it sounds very useful, especially when you have a lot of objects that only differ insignificantly, or when you want to copy some large object quickly. And it sounds as if all the parts needed for this were there. So, is something like this in Linux? Or in any other Unix? Or any other System?
