[LCP] mapping memory

Paul Gearon gearon at ieee.org
Tue Nov 4 11:18:16 EST 2008


On Mon, Nov 3, 2008 at 5:48 PM, Mark Farnell <mark.farnell at gmail.com> wrote:
> In a Linux process, I have malloc'ed a piece of memory.  Within this
> process, are there any ways to map this chunk of memory to a different
> address?

If the memory were given to you by mmapping a region of a file (from,
say, ramfs) then you could try using mmap on it a second time, with
the address set to where you want to map it to.... but I doubt that
would work. I'm pretty sure that's only valid for use between
different processes.

Basically, I think you just need to memcpy the memory.

Paul



More information about the linuxCprogramming mailing list