Aren't anonymous mmap'ed pages automatically zeroed for you? (It has to be this way for security reasons.) So I'd guess you could just make an anonymous mmap (or the Windows equivalent) and you'd get what you want.
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. I don't know about Windows, though. On Sun, Jan 13, 2013 at 5:43 PM, Robert O'Callahan <rob...@ocallahan.org> wrote: > I need a big read-only buffer full of zeroes. On Linux I could mmap > /dev/zero read-only, and something similar on Windows/Mac I'm sure, but do > we already have code for that, or better yet something like that already > mapped into memory? > > Rob > -- > Jesus called them together and said, “You know that the rulers of the > Gentiles lord it over them, and their high officials exercise authority > over them. Not so with you. Instead, whoever wants to become great among > you must be your servant, and whoever wants to be first must be your > slave — just > as the Son of Man did not come to be served, but to serve, and to give his > life as a ransom for many.” [Matthew 20:25-28] > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform