Source code
Revision control
Copy as Markdown
Other Tools
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
#include "mozjemalloc.h"
#include <mozilla/Assertions.h>
#ifdef XP_WIN
# include <sysinfoapi.h>
#else
# include <unistd.h>
#endif
size_t GetKernelPageSize() {
static size_t kernel_page_size = ([]() {
#ifdef XP_WIN
SYSTEM_INFO info;
GetSystemInfo(&info);
return info.dwPageSize;
#else
long result = sysconf(_SC_PAGESIZE);
MOZ_ASSERT(result != -1);
return result;
#endif
})();
return kernel_page_size;
}