27 static constexpr
int kb(
int kilos) {
31 static constexpr
int mb(
int megs) {
32 return kb(megs * 1024);
35 TEST(JemallocHugePageAllocatorTest, Basic) {
56 auto array_of_arrays =
new (
ptr) std::array<int, 100>[5];
67 TEST(JemallocHugePageAllocatorTest, LargeAllocations) {
122 TEST(JemallocHugePageAllocatorTest, MemoryUsageTest) {
131 using Vec32 = std::vector<c32, folly::CxxHugePageAllocator<c32>>;
133 for (
int i = 0;
i < 10;
i++) {
143 using Vec320 = std::vector<c320, folly::CxxHugePageAllocator<c320>>;
145 for (
int i = 0;
i < 10;
i++) {
146 vec320.push_back({});
155 std::vector<std::unique_ptr<void, decltype(deleter)>> ptr_vec;
156 auto alloc = [&ptr_vec, &deleter](
size_t size) {
160 for (
int i = 0;
i < 10;
i++) {
167 for (
int i = 0;
i < 10;
i++) {
174 for (
int i = 0;
i < 10;
i++) {
236 TEST(JemallocHugePageAllocatorTest, STLAllocator) {
238 using MyVec = std::vector<int, MyVecAllocator>;
240 using MyMapAllocator =
271 auto map2_ptr = std::make_unique<MyMap>();
272 MyMap& map2 = *map2_ptr;
297 map1[1].reserve(200);
TEST(JemallocHugePageAllocatorTest, Basic)
static constexpr int kb(int kilos)
static bool addressInArena(void *address)
static size_t freeSpace()
#define EXPECT_EQ(val1, val2)
constexpr detail::Map< Move > move
static void * allocate(size_t size)
#define EXPECT_GE(val1, val2)
static void deallocate(void *p, size_t=0)
constexpr auto size(C const &c) -> decltype(c.size())
#define EXPECT_TRUE(condition)
static bool init(int nr_pages)
static constexpr int mb(int megs)
#define EXPECT_NE(val1, val2)
#define EXPECT_FALSE(condition)
static constexpr uint64_t data[1]
static bool initialized()