If you're using popen() I presume you're on Linux. (At least, I don't think that's a cross-platform function....is it?)

If so, you may find this useful:
http://fscked.org/writings/SHM/shm.html