Of course, I imagine your goal is not to pull in pages in RAM for these zero pages. I suspect mmap may do what you want on Linux and Mac, so long as you don't write to the pages.
Yes, all zeroed pages are mapped to the same physical page under Linux. They get a new physical mapping only when you write to them so you can allocate as many as you want while impacting only a process' VSIZE (I would assume MacOS X does the same).
I don't know about Windows, though.
VirtualAllocEx() does map zeroed memory but I do not know if it maps all zeroed pages to the same physical page as Linux does. Verifying it should be easy enough though.
Gabriele _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform